I get to array value from web service. This array is 1 or more than 1-element array.If tempArra is 1 dimesional array and then If I want to transfer the data in the array to another array(garbageDatesFor01) Then I get the error
EDIT: returning to the web service responses in 2 ways
RESPONSE 1
(
(
"2011-08-03",
"2011-08-17"
)
)
OR
RESPONSE 2
2011-08-04
NSArray *garbageDatesFor01=[[NSArray alloc] initWithArray:tempArr];
2011-08-26 18:43:35.689 AOK[1846:207] -[NSCFString count]: unrecognized selector sent to instance 0x990d8f0
2011-08-26 18:43:35.691 AOK[1846:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString count]: unrecognized selector sent to instance 0x990d8f0'
*** Call stack at first throw:
(
0 CoreFoundation 0x015d25a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01726313 objc_exception_throw + 44
2 CoreFoundation 0x015d40bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x01543966 ___forwarding___ + 966
4 CoreFoundation 0x01543522 _CF_forwarding_prep_0 + 50
5 CoreFoundation 0x01535d87 -[NSArray initWithArray:] + 39
6 TwenteMilieu 0x0001323a -[ForgottenContainerT1 connectionDidFinishLoading:] + 3750
7 Foundation 0x00113112 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 108
8 Foundation 0x0011306b _NSURLConnectionDidFinishLoading + 133
9 CFNetwork 0x0117148e _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 220
10 CFNetwork 0x0123c6e1 _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 293
11 CFNetwork 0x01167c80 _ZN19URLConnectionClient13processEventsEv + 100
12 CFNetwork 0x01167acf _ZN17MultiplexerSource7performEv + 251
13 CoreFoundation 0x015b38ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
14 CoreFoundation 0x0151188b __CFRunLoopDoSources0 + 571
15 CoreFoundation 0x01510d86 __CFRunLoopRun + 470
16 CoreFoundation 0x01510840 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x01510761 CFRunLoopRunInMode + 97
18 GraphicsServices 0x01b411c4 GSEventRunModal + 217
19 GraphicsServices 0x01b41289 GSEventRun + 115
20 UIKit 0x0037fc93 UIApplicationMain + 1160
21 TwenteMilieu 0x00002644 main + 102
22 TwenteMilieu 0x000025d5 start + 53
)
terminate called after throwing an instance of 'NSException'
Current language: auto; currently objective-c
The important line is :
2011-08-26 18:43:35.689 TwenteMilieu[1846:207] -[NSCFString count]: unrecognized selector sent to instance 0x990d8f0
It means you are calling count on a string. The object you think is an array is actually a string.
From looking at your code, tempArr could be either an array or a string. Try this:
if ([tempArr isKindOfClass:[NSArray class]])
{
// Handle array case
}
else if ([tempArr isKindOfClass:[NSString class]])
{
// Handle string case
}
It's probably a good idea to change the name of tempArr to something else, like tempResponse or similar.
Related
I have a table view in which Iam selecting a row of the table view and then it hits the web services, retrieves data and then displayed. Now this is my error log Iam getting.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-
[__NSCFData setDownloadedLogoImage:]: unrecognized selector sent to instance 0x806cf90'
*** Call stack at first throw:
(
0 CoreFoundation 0x02abdb99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x02c0d40e objc_exception_throw + 47
2 CoreFoundation 0x02abf6ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x02a2f2b6 ___forwarding___ + 966
4 CoreFoundation 0x02a2ee72 _CF_forwarding_prep_0 + 50
5 FlightSearch 0x000401ef -[AirlineNames connectionDidFinishImage:] + 168
6 FlightSearch 0x0002f535 -[SAHttpManager connectionDidFinishLoading:] + 195
7 Foundation 0x001acb96 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 108
8 Foundation 0x001acaef _NSURLConnectionDidFinishLoading + 133
9 CFNetwork 0x0307172f _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 285
10 CFNetwork 0x0313cfcf _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 389
11 CFNetwork 0x03066968 _ZN19URLConnectionClient13processEventsEv + 100
12 CFNetwork 0x030667e5 _ZN17MultiplexerSource7performEv + 251
13 CoreFoundation 0x02a9efaf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
14 CoreFoundation 0x029fd39b __CFRunLoopDoSources0 + 571
15 CoreFoundation 0x029fc896 __CFRunLoopRun + 470
16 CoreFoundation 0x029fc350 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x029fc271 CFRunLoopRunInMode + 97
18 GraphicsServices 0x032b000c GSEventRunModal + 217
19 GraphicsServices 0x032b00d1 GSEventRun + 115
20 UIKit 0x00419af2 UIApplicationMain + 1160
21 FlightSearch 0x00001e86 main + 84
22 FlightSearch 0x00001e29 start + 53
23 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Kindly suggest me what should i do.
You're sending the message setDownloadedLogoImage: to an NSData object, which has no idea what to do with it! One of two things has happened:
1) You have not retained something. Take a look at whatever object you expect to call setDownloadedLogoImage on and find out where you create it - you should probably be retaining it there ;)
2) (less likely) Your code is just wrong! Add it to your question and we can take a look.
New in iOS, here is Question:
I am using xcode 4.0.2 iso-4.3.2.
Here I have a table and I am creating one mutable array like
mainarray=[[NSMutableArray alloc]initWithObjects:#"Hi",#"Hello"nil];
and sending that value to.Table delegate method like
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
here value is coming but once I am sending dynamically value to the mainarray like
mainarray=[[NSMutableArray alloc]initWithObjects:[dataarray valueForKey:#"first_name"],nil]; or
[mainarray addobject:[dataarray valueForKey:#"first_name"]]
and sending that mainarray value to cell.textlabel.text then my program is terminating and sending this error message.
2011-05-11 10:29:10.346 picture:vide[742:207] -[__NSArrayI isEqualToString:]: unrecognized selector sent to instance 0x4e85200
2011-05-11 10:29:10.348 picture:vide[742:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI isEqualToString:]: unrecognized selector sent to instance 0x4e85200'
*** Call stack at first throw:
(
0 CoreFoundation 0x00ddb5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f2f313 objc_exception_throw + 44
2 CoreFoundation 0x00ddd0bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d4c966 ___forwarding___ + 966
4 CoreFoundation 0x00d4c522 _CF_forwarding_prep_0 + 50
5 UIKit 0x003ecafc -[UILabel setText:] + 72
6 picture:vide 0x000050c9 -[VideoChatController1 tableView:cellForRowAtIndexPath:] + 376
7 UIKit 0x00340b98 -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 634
8 UIKit 0x003364cc -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 75
9 UIKit 0x0034b8cc -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1561
10 UIKit 0x0034390c -[UITableView layoutSubviews] + 242
11 QuartzCore 0x01d7ba5a -[CALayer layoutSublayers] + 181
12 QuartzCore 0x01d7dddc CALayerLayoutIfNeeded + 220
13 QuartzCore 0x01d230b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
14 QuartzCore 0x01d24294 _ZN2CA11Transaction6commitEv + 292
15 QuartzCore 0x01d2446d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
16 CoreFoundation 0x00dbc89b __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
17 CoreFoundation 0x00d516e7 __CFRunLoopDoObservers + 295
18 CoreFoundation 0x00d1a1d7 __CFRunLoopRun + 1575
19 CoreFoundation 0x00d19840 CFRunLoopRunSpecific + 208
20 CoreFoundation 0x00d19761 CFRunLoopRunInMode + 97
21 GraphicsServices 0x017321c4 GSEventRunModal + 217
22 GraphicsServices 0x01732289 GSEventRun + 115
23 UIKit 0x002d9c93 UIApplicationMain + 1160
24 picture:vide 0x00002910 main + 102
25 picture:vide 0x000028a1 start + 53
)
Please, help.
Here you are getting this terminating log because
dataArray is an NSArray you can't call [dataarray valueForKey:#"first_name"] this
because this unreconised for NSArray
rether than this you may use some thing like this
[[dataarray objectAtIndex:index] valueForKey:#"first_name"]
[__NSArrayI isEqualToString:]: is the issue. You are using the isEqualToString: for an array somewhere. Check that. Its a method of NSString
Initialization of array was wrong.
Following line
mainarray=[[NSMutableArray alloc]initWithObjects:#"Hi",#"Hello"nil];
should be corrected as
mainarray=[[NSMutableArray alloc]initWithObjects:#"Hi",#"Hello" , nil];
Please note the new comma between #"Hello" and nil
I have encountered application termination while dismissing a modal view controller.
-[NSCFString window]: unrecognized selector sent to instance 0x6337dc0
2011-06-03 13:26:37.980 Tuscany[19657:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString window]: unrecognized selector sent to instance 0x6337dc0'
*** Call stack at first throw:
(
0 CoreFoundation 0x016ffbe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x018545c2 objc_exception_throw + 47
2 CoreFoundation 0x017016fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x01671366 ___forwarding___ + 966
4 CoreFoundation 0x01670f22 _CF_forwarding_prep_0 + 50
5 UIKit 0x003f4024 -[UIViewController viewControllerForRotation] + 81
6 UIKit 0x003ee8ab -[UIViewController shouldWindowUseOnePartInterfaceRotationAnimation:] + 34
7 UIKit 0x00368dd5 -[UIWindow _clientsForRotation] + 350
8 UIKit 0x0036b87b -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 141
9 UIKit 0x005eb948 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1053
10 UIKit 0x003f7682 -[UIViewController _dismissModalViewControllerWithTransition:from:] + 2075
11 UIKit 0x003f4324 -[UIViewController dismissModalViewControllerWithTransition:] + 579
12 Foundation 0x000c37f6 __NSFireDelayedPerform + 441
13 CoreFoundation 0x016e0fe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
14 CoreFoundation 0x016e2594 __CFRunLoopDoTimer + 1220
15 CoreFoundation 0x0163ecc9 __CFRunLoopRun + 1817
16 CoreFoundation 0x0163e240 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x0163e161 CFRunLoopRunInMode + 97
18 GraphicsServices 0x01d88268 GSEventRunModal + 217
19 GraphicsServices 0x01d8832d GSEventRun + 115
20 UIKit 0x0035342e UIApplicationMain + 1160
21 Tuscany 0x00002878 main + 102
22 Tuscany 0x00002809 start + 53
)
terminate called after throwing an instance of 'NSException'
Above is the crash log. Please help.
Thanks in advance.
From you log it seems that you are calling window on an NSCFString. NSCFString does not have a window selector, and the compiler would complain if you try and do so, so it is likely that you are sending that message to a deallocated object (imagine that a new object has been allocated where another one was previously), or you are messing with casts.
In case you suspect that you are sending the message to a deallocated object, enable NSZombies.
Without seeing the code, it is not possible to help you further, though.
i am parsing the data from web service.After parsing the few records it gives this error.Somebody please the tell me what the reason behind this error?
[NSXMLParser length]: unrecognized selector sent to instance 0x6e6d340
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSXMLParser length]: unrecognized selector sent to instance 0x6e6d340'
*** Call stack at first throw:
(
0 CoreFoundation 0x026c4919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x028125de objc_exception_throw + 47
2 CoreFoundation 0x026c642b -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x02636116 ___forwarding___ + 966
4 CoreFoundation 0x02635cd2 _CF_forwarding_prep_0 + 50
5 Foundation 0x001053e9 -[NSXMLParser parse] + 104
6 SexOffenders 0x00009c30 -[UserProfileVC connectionDidFinishLoading:] + 565
7 Foundation 0x0006e666 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 108
8 Foundation 0x0006e5bf _NSURLConnectionDidFinishLoading + 133
9 CFNetwork 0x02c569f1 _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 285
10 CFNetwork 0x02d1fc72 _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 402
11 CFNetwork 0x02d200ea _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 1546
12 CFNetwork 0x02d200ea _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 1546
13 CFNetwork 0x02c4bdfe _ZN19URLConnectionClient13processEventsEv + 100
14 CFNetwork 0x02c4bc95 _ZN17MultiplexerSource7performEv + 247
15 CoreFoundation 0x026a5d7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
16 CoreFoundation 0x026041dd __CFRunLoopDoSources0 + 333
17 CoreFoundation 0x026037c6 __CFRunLoopRun + 470
18 CoreFoundation 0x02603280 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x026031a1 CFRunLoopRunInMode + 97
20 GraphicsServices 0x02f292c8 GSEventRunModal + 217
21 GraphicsServices 0x02f2938d GSEventRun + 115
22 UIKit 0x002dab58 UIApplicationMain + 1160
23 SexOffenders 0x00002198 main + 102
24 SexOffenders 0x00002129 start + 53
)
terminate called after throwing an instance of 'NSException'
'-[NSXMLParser length]: unrecognized selector sent to instance 0x6e6d340
this shows you are calling a function which is not a member function of NSXMLParser class.
actually in your code you are calling any method which can not be invoke on the obeject of NSXMLParser class.
chechk by debugging pointer.
I just suffered from this same issue. For me the problem was caused by this line of code:
operation.responseSerializer = [AFXMLParserResponseSerializer serializer];
This serialised the responseObject I was passing into the parser to XML but the parser expects an NSData object. Simply getting rid of that line solved the problem.
I also faced the similar problem.
Fixed by changing my line
self.xmlParser = [[NSXMLParser alloc] initWithData:data];
to
self.xmlParser = (NSXMLParser *)responseObject;
I found my solution from this blog
Raywanderlick Blog
Explanation for Error
This configuration of [AFXMLParserResponseSerializer serializer] already return an initialized object and I was initializing it again using already initialized parser by considering it data object.
Commenting following line didn't work for me as suggested by #Hodson answer above and it doesn't make sense as this is default configuration of AFTNetworking library.
operation.responseSerializer = [AFXMLParserResponseSerializer serializer];
I am trying to copy one array to another:
NSMutableArray *itemsCopy = [[NSMutableArray alloc] initWithArray:self.items copyItems:YES];
but I get the error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Item copyWithZone:]: unrecognized selector sent to instance 0x5a74900'
*** Call stack at first throw:
(
0 CoreFoundation 0x025afc99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x026fd5de objc_exception_throw + 47
2 CoreFoundation 0x025b17ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x02521496 ___forwarding___ + 966
4 CoreFoundation 0x02521052 _CF_forwarding_prep_0 + 50
5 CoreFoundation 0x025108fa -[NSObject(NSObject) copy] + 42
6 CoreFoundation 0x025ab732 -[NSArray initWithArray:range:copyItems:] + 290
7 CoreFoundation 0x02513963 -[NSArray initWithArray:copyItems:] + 99
8 MyViewController 0x0000787d -[MyViewController tableView:didSelectRowAtIndexPath:] + 258
9 UIKit 0x003968f8 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140
10 UIKit 0x0038d1de -[UITableView _userSelectRowAtIndexPath:] + 219
11 Foundation 0x000a404e __NSFireDelayedPerform + 441
12 CoreFoundation 0x025910c3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
13 CoreFoundation 0x02592704 __CFRunLoopDoTimer + 1364
14 CoreFoundation 0x024ef089 __CFRunLoopRun + 1817
15 CoreFoundation 0x024ee600 CFRunLoopRunSpecific + 208
16 CoreFoundation 0x024ee521 CFRunLoopRunInMode + 97
17 GraphicsServices 0x02db52c8 GSEventRunModal + 217
18 GraphicsServices 0x02db538d GSEventRun + 115
19 UIKit 0x00332e8f UIApplicationMain + 1160
20 MyViewController 0x0000210c main + 102
21 MyViewController 0x0000209d start + 53
)
terminate called after throwing an instance of 'NSException'
You need to make sure all the contents of self.items adopt the NSCopying protocol.
If you just want a shallow copy, send the -mutableCopy message to self.items.
NSMutableArray *itemsCopy = [self.items mutableCopy];
You have to provide your classes with the copyWithZone selector (according to NSCopying protocol) if you are not copying objects that implement that protocol by default.
So if you are copying custom objects you have to implement it. The copy method always calls copyWithZone.. and you must always provide the implementation, it can't know what to copy inside objects by itself..