开发者

NSDictionary sigbart

开发者 https://www.devze.com 2023-04-02 10:56 出处:网络
i have some very strang behavior in iOS when using a NSMutableDictionary. I am using the following code to access a dictionary from the app delegate.

i have some very strang behavior in iOS when using a NSMutableDictionary. I am using the following code to access a dictionary from the app delegate.

self.dictTyp = appDelegate.dictTyp;
NSLog(@"%@", dictTyp);
NSArray *keys = [dictTyp allKeys];

The output of the NSLog is fine and it shows the content of the dictionary. but in the next line when i want to get allKeys i get an failure with unrecognized se开发者_JAVA技巧lector. can anybody tell me what i am doing wrong ?

thanks, martin


Modify NSLog to print out the type, too:

NSLog(@"%@ %@", dictTyp, [dictType class]);

Check if dicType isn't a dictionary but something else. Then go back to where you created it and make sure it is actually created as a dictionary and that it is properly retained and not released too early.

0

精彩评论

暂无评论...
验证码 换一张
取 消