今天干活的时候,遇到了这样一个问题..
实在是太粗心了。mark下,
2014-01-05 11:44:34.762 softwareApp[1435:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[JKDictionary setObject:forKey:]:
mutating method sent to immutable object'
*** First throw call stack:
(0x285a012 0x1e48e7e 0x2859deb 0x36b96 0x18610ef 0x6c8df 0xabd61 0xac0f8 0x1e5c6b0 0x1bc3b 0x1e5c6b0 0x1888765 0x27ddf3f 0x27dd96f 0x2800734 0x27fff44 0x27ffe1b 0x2a927e3
0x2a92668 0xd8cffc 0x2d5d 0x2551725 0x1)
libc++abi.dylib: terminate called throwing an exception
Program ended with exit code: 0
这是报错处的代码。
NSDictionary *jsonData = [resultDic objectAtIndex:i];
NSArray *eachLines = [[jsonData objectForKey:@"newsTime"] componentsSeparatedByString:@"."];
[jsonData setValue:[eachLines objectAtIndex:0] forKey:@"newsTime"];
[testArr addObject:jsonData];
…现在想想都觉得丢人阿。
看reason:后面的异常说明:意思是我把一个可变量对应的方法让一个不可变量来调用
mutating method(可变量对应的方法):是那些在创建后可以被更改的变量所拥有的method,比如NSMutableArray,NSMutableDictionary 等
immutable object(不可改变的变量):就是那些被创建后不能被改变的变量:比如 NSArray NSDictionary等
修改后,正常运行。
NSMutableDictionary *jsonData = [resultDic objectAtIndex:i];
NSArray *eachLines = [[jsonData objectForKey:@"newsTime"] componentsSeparatedByString:@"."];
[jsonData setValue:[eachLines objectAtIndex:0] forKey:@"newsTime"];
[testArr addObject:jsonData];
学习的路上,与君共勉。
分享到:
相关推荐
Kubernetes突变Webhook
这对于开发Webhook服务器很有用 使用make start-docker启动服务器 通过make send-request位于./examples/admission-review.example.json中的示例make send-request 使用make stop-docker销毁docker环境 构建Docker...
Kubernetes突变Webhook用于Sidecar注入 此tutoral显示了如何构建和部署 :注射nginx的边车容器插入到持久对象的现有吊舱。 先决条件 v1.12 +版本 版本17.03+ 版本v1.11.3 + 访问Kubernetes v1.11.3 +集群与...
mutating func removeObject(object: U) -> Element? { if count > 0 { for index in startIndex ..< endIndex { if (self[index] as! U) === object { return self.removeAtIndex(index) } } } return ...
k8s-webhooks-东西此项目docker映像对于该项目的图像,您可以看到此dockerhub存储使用最新图片(图片> = v1.0.5)设置此变异Webhook kubectl apply -f mutating-webhook-configuration.yamlkubectl apply -f ...
theme of the book is how to use object-oriented programming (OOP) to do verification well. We focus on real-world examples, bloopers, and code snippets. Sure, we talk about programming theory, but the...
达尔文广场空间 MutationObserver的直通实现旨在使它更易于使用,处理DOM查询,浏览器兼容性以及其他... '.my-mutating-node' ] } ) ; 使用ES6 如果您希望自己处理转储和填充,可以从Darwin导入ES6: import darwin
耐受注射挂钩Mutating Admission ...这个示例webhook的作用在mutating-webhook/main.go我们定义了一个变异的wehbook服务器,该服务器接受来自k8s apiserver的请求。 它处理该请求并始终接受准入请求。 此外,它还修改了
✔ Passing Function To setState() ✔ Decorators ✔ Feature Flags ✔ Component Switch ✔ Reaching Into A Component ✔ List Components ✔ Format Text via Component ✔ Share Tracking Logic Anti-Patterns ...
.map() 是一种 non-mutating(非变异) 方法,它创建一个新数组,而不是只对调用数组进行更改的 mutating(变异) 方法。这可能很难记住。 语法: array.map(function(currentValue,index,arr), thisValue) current...
C++ STL标准模板库在数据结构和算法的实践领域发挥着重要作用,极大的提高了开发效率。STL的三大组成部分为容器、迭代器、算法,本文主要讲解STL算法中的非变易算法。本文从实践的角度简单介绍了一下相关函数的使用...
8.4 Mutating Objects with shelve 8.5 Accesssing a MySQL Database 8.6 Storing a BLOB in a MySQL Database 8.7 Storing a BLOB in a PostgreSQL Database 8.8 Generating a Dictionary Mapping from ...
Create more reliable code with closures and immutable data In Detail JavaScript is a high-level, dynamic, untyped, lightweight, and interpreted programming language and functional programming is a ...
Adapting a File-like Object to a True File Object Recipe 2.16. Walking Directory Trees Recipe 2.17. Swapping One File Extension for Another Throughout a Directory Tree Recipe 2.18. Finding a ...
// Mutating the object automatically saves to fileobject . name = 'John Doe' :rocket: 安装npm i reactive-json-file :gear_selector: 选件throttle <Number> -节流节省的毫秒<Number> 。 保存已在每个事件循环...
开源项目-rogeralsing-go-genetic-math.zip,Genetic programming in Go, Breeding and mutating formulas to solve math problems
Tape by Square, Inc. Tape is a collection of queue-related classes for Android and Java. ...an I/O exception is thrown during a mutating change, the change is aborted. NOTE: The current implementation
Int32 = 8} var structValue = StructValue()let structValuePointer = withUnsafePointer(to:&structValue){UnsafeMutableRawPointer(mutating:$ 0)} structValuePointer.advanced(by:2)....