Hi all, i try to convert NSDictionary element to a NSData element:
...
while ((key = [enumerator nextObject]))
{
NSString *temp = [dictionary objectForKey:key];
if ([key isEqualToString:@"results"])
{
//Crash HERE! -------------------------->>>>
NSData *myData2 = [temp dataUsingEncoding:NSUTF32BigEndianStringEncoding];
NSDictionary *dictionary2 = [[CJSONDeserializer deserializer] deserializeAsDictionary:myData2 error:&error];
NSLog(@"Error: %@",error);
//print dictionary
NSEnumerator *enumerator2 = [dictionary2 keyEnumerator];
id key2;
while (key2 = [enumerator2 nextObject])
{
NSLog(@"Chiave: %@ | valore: %@",key2,[dictionary objectForKey:key2] );
}
}
}
...
but in this way crash with:
-[__NSArrayI dataUsingEncoding:]: unrecognized selector sent to instance 0x5b1c590
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI dataUsingEncoding:]: unrecognized selector sent to instance 0x5b1c590'
*** Call stack at first throw:
(
0 CoreFoundation 0x025fe919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0274c5de objc_exception_throw + 47
2 CoreFoundation 0x0260042b -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x02570116 ___forwarding___ + 966
4 CoreFoundation 0x0256fcd2 _CF_forwarding_prep_0 + 50
5 taxi rider 0x00002722 -[taxi_riderViewController viewDidLoad] + 1508
6 UIKit 0x00375c26 -[UIViewController view] + 179
7 taxi rider 0x00001f61 -[taxi_riderAppDelegate application:didFinishLaunchingWithOptions:] + 74
8 UIKit 0x002ce543 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
9 UIKit 0x002d09a1 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 346
10 UIKit 0x002da452 -[UIApplication handleEvent:withNewEvent:] + 1958
11 UIKit 0x002d3074 -[UIApplication sendEvent:] + 71
12 UIKit 0x002d7ac4 _UIApplicationHandleEvent + 7495
13 GraphicsServices 0x02c78afa PurpleEventCallback + 1578
14 CoreFoundation 0x025dfdc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
15 CoreFoundation 0x02540737 __CFRunLoopDoSource1 + 215
16 CoreFoundation 0x0253d9c3 __CFRunLoopRun + 979
17 CoreFoundation 0x0253d280 CFRunLoopRunSpecific + 208
18 CoreFoundation 0x0253d1a1 CFRunLoopRunInMode + 97
19 UIKit 0x002d0226 -[UIApplication _run] + 625
20 UIKit 0x002dbb58 UIApplicationMain + 1160
21 taxi rider 0x00001ef4 main + 102
22 taxi rider 0x00001e85 start + 53
)
terminate called after throwing an instance of 'NSException'
Anyone have ideas?