I am using http://www.sudzc.com/ to access SOAP Web Services in my iPhone application. I have a method in ASP.NET that takes a string and returns a string (facebook access token to be exact).
This string is the following:
iOCCeM4WGIwBlDxECRFr4AfIEsW598Z4sYjk2uMxsyo.eyJpdiI6IkZPQlN1YWlGNXY0aWs3SmFMWFUwcVEifQ.ITh3ZBGrbgU8DsYWz6d-S4Q1iNlQ8DwKGZB6RZvOkTUpa0VmW7qFS6MO1tkauHoJMFrOlwSrvVuMEO_SQTh8xtR2d0219PPSshiYBHYkjsokSYTuyIaSclVIrL2vh7xH
Every now and then I get an error like the following in my application and I'm not quite sure why. The actual string is a nvarchar(255) field within my database.
This error does not happen all the time. But it has happened quite a few times.
Any help would be greatly appreciated as to how I can fix this issue.
Thanks in advance.
Entity: line 20: parser error : AttValue: " or ' expected
<span><H1>Server Error in '/' Application.<hr width=100% size=1 colo
^
Entity: line 20: parser error : attributes construct error
<span><H1>Server Error in '/' Application.<hr width=100% size=1 colo
^
Entity: line 20: parser error : Couldn't find end of Start Tag hr line 20
<span><H1>Server Error in '/' Application.<hr width=100% size=1 colo
^
Entity: line 31: parser error : AttValue: " or ' expected
<table width=100% bgcolor="#ffffcc">
^
Entity: line 31: parser error : attributes construct error
<table width=100% bgcolor="#ffffcc">
^
Entity: line 31: parser error : Couldn't find end of Start Tag table line 31
<table width=100% bgcolor="#ffffcc">
^
Entity: line 46: parser error : Opening and ending tag mismatch: br line 29 and table
</table>
^
Entity: line 52: parser error : AttValue: " or ' expected
<table width=100% bgcolor="#ffffcc">
^
Entity: line 52: parser error : attributes construct error
<table width=100% bgcolor="#ffffcc">
^
Entity: line 52: parser error : Couldn't find end of Start Tag table line 52
<table width=100% bgcolor="#ffffcc">
^
Entity: line 67: parser error : Opening and ending tag mismatch: br line 50 and table
</table>
^
Entity: line 71: parser error : Opening and ending tag mismatch: br line 69 and body
</body>
^
Entity: line 72: parser error : Opening and ending tag mismatch: br line 50 and html
</html>
^
Entity: line 73: parser error : Premature end of data in tag br line 48
^
Entity: line 73: parser error : Premature end of data in tag br line 29
^
Entity: line 73: parser error : Premature end of data in tag br line 27
^
Entity: line 73: parser error : Premature end of data in tag br line 27
^
Entity: line 73: parser error : Premature end of data in tag font line 24
^
Entity: line 73: parser error : Premature end of data in tag body line 18
^
Entity: line 73: parser error : Premature end of data in tag html line 1
^
2011-05-06 16:15:55.939 MyProject[9206:707] -[NSError AccessToken]: unrecognized selector sent to instance 0x4b87a10
2011-05-06 16:15:56.040 MyProject[9206:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSError AccessToken]: unrecognized selector sent to instance 0x4b87a10'
*** Call stack at first throw:
(
0 CoreFoundation 0x3237064f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x365b3c5d objc_exception_throw + 24
2 CoreFoundation 0x323741bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x32373649 ___forwarding___ + 508
4 CoreFoundation 0x322ea180 _CF_forwarding_prep_0 + 48
5 MyProject 0x000093ab -[MyAccountVC handlerGetUserByAccessToken:] + 46
6 CoreFoundation 0x322ddf03 -[NSObject(NSObject) performSelector:withObject:] + 22
7 MyProject 0x00026309 -[SoapRequest handleError:] + 148
8 MyProject 0x00026737 -[SoapRequest connectionDidFinishLoading:] + 254
9 Foundation 0x31f4a2f5 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 68
10 Foundation 0x31f4a277 _NSURLConnectionDidFinishLoading + 78
11 CFNetwork 0x35e71411 _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 136
12 CFNetwork 0x35e65f49 _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 100
13 CFNetwork 0x35e65e3b _ZN19URLConnectionClient13processEventsEv + 70
14 CFNetwork 0x35e65ded _ZN13URLConnection24multiplexerClientPerformEP18RunLoopMultiplexer + 36
15 CFNetwork 0x35e65d5f _ZN17MultiplexerSource7performEv + 126
16 CFNetwork 0x35e65cdd _ZN17MultiplexerSource8_performEPv + 8
17 CoreFoundation 0x32347a79 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
18 CoreFoundation 0x3234975f __CFRunLoopDoSources0 + 382
19 CoreFoundation 0x3234a4eb __CFRunLoopRun + 230
20 CoreFoundation 0x322daec3 CFRunLoopRunSpecific + 230
21 CoreFoundation 0x322dadcb CFRunLoopRunInMode + 58
22 GraphicsServices 0x3058241f GSEventRunModal + 114
23 GraphicsServices 0x305824cb GSEventRun + 62
24 UIKit 0x35550d69 -[UIApplication _run] + 404
25 UIKit 0x3554e807 UIApplicationMain + 670
26 MyProject 0x00003f73 main + 70
27 MyProject 0x00003f28 start + 40
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
Looks like my web service is down and I'm simply not handling it properly in Objective-C. Hence why it's returning HTML (ASP.NET error page) instead of the string.
Related
I am getting the following error please help me with a solution. My xcode gets aborted with the following error
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array'
*** Call stack at first throw:
(
0 CoreFoundation 0x0140a5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0155e313 objc_exception_throw + 44
2 CoreFoundation 0x014000a5 -[__NSArrayM objectAtIndex:] + 261
3 UMMCelebrity 0x00043903 -[UMMFlickrView photoGallery:urlForPhotoSize:atIndex:] + 115
4 UMMCelebrity 0x0004a9d6 -[FGalleryViewController createGalleryPhotoForIndex:] + 422
5 UMMCelebrity 0x0004a5ac -[FGalleryViewController loadThumbnailImageWithIndex:] + 172
6 UMMCelebrity 0x0004a189 -[FGalleryViewController preloadThumbnailImages] + 281
7 UMMCelebrity 0x00046f84 -[FGalleryViewController loadView] + 2132
8 UIKit 0x0029d00e -[UIViewController view] + 56
9 UMMCelebrity 0x00043050 -[UMMFlickrView pushphotoview] + 192
10 UMMCelebrity 0x000446c6 -[UMMFlickrView connection:didReceiveData:] + 2230
11 Foundation 0x00996835 _NSURLConnectionDidReceiveData + 159
12 CFNetwork 0x033bde72 _ZN19URLConnectionClient21_clientDidReceiveDataEPK8__CFDataPNS_26ClientConnectionEventQueueE + 262
13 CFNetwork 0x0348a6b3 _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 247
14 CFNetwork 0x0348a9cf _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 1043
15 CFNetwork 0x033b5c80 _ZN19URLConnectionClient13processEventsEv + 100
16 CFNetwork 0x033b5acf _ZN17MultiplexerSource7performEv + 251
17 CoreFoundation 0x013eb8ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
18 CoreFoundation 0x0134988b __CFRunLoopDoSources0 + 571
19 CoreFoundation 0x01348d86 __CFRunLoopRun + 470
20 CoreFoundation 0x01348840 CFRunLoopRunSpecific + 208
21 CoreFoundation 0x01348761 CFRunLoopRunInMode + 97
22 GraphicsServices 0x018e21c4 GSEventRunModal + 217
23 GraphicsServices 0x018e2289 GSEventRun + 115
24 UIKit 0x001fbc93 UIApplicationMain + 1160
25 UMMCelebrity 0x00001d29 main + 121
26 UMMCelebrity 0x00001ca5 start + 53
)
terminate called after throwing an instance of 'NSException'
You're calling objectAtIndex: with the argument 0 on an empty NSMutableArray.
[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array
If you know the NSMutableArray can be empty, you should consider calling count on it to see if it does indeed contain any elements, before trying to access the elements.
Obviously, there's an empty NSMutableArray in -[UMMFlickrView photoGallery:urlForPhotoSize:atIndex:] and you sent it objectAtIndex: with argument 0.
That means your NSMutableArray is empty. I think you didn't allocate the memory for NSMutableArray. Read this link, it may be helpful for you.
http://www.roseindia.net/answers/viewqa/Mobile-Applications/14614-NSMutableArray-Example-Code.html
May be on the 4th click nothing is pushed into the array, I'm not sure as I have no idea what you are trying to do.If you can add the code line that adds the object into your array, we could help you.
This error is occurring because the array is empty for sure.
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 don't understand on how to debug this error message:
2011-02-01 20:45:56.151 NeMe[3206:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array'
*** Call stack at first throw:
(
0 CoreFoundation 0x027deb99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0292e40e objc_exception_throw + 47
2 CoreFoundation 0x027d4695 -[__NSArrayM objectAtIndex:] + 261
3 NeighborMe 0x0000f617 -[NeighborMapViewController regionFromLocations] + 65
4 NeighborMe 0x0001047b -[NeighborMapViewController locationManager:didUpdateToLocation:fromLocation:] + 94
5 CoreLocation 0x02393870 -[CLLocationManager onClientEventLocation:] + 793
6 CoreLocation 0x0239218b OnClientEvent + 49
7 CoreLocation 0x023a8a83 _Z22CLClientInvokeCallbackP10__CLClient13CLClientEventPK14__CFDictionary + 47
8 CoreLocation 0x023a9b2c _Z27CLClientHandleDaemonDataFixP10__CLClientPK23CLDaemonCommToClientFixPK14__CFDictionary + 290
9 CoreLocation 0x023acb30 _Z24CLClientHandleDaemonDataP12__CFMachPortPvlS1_ + 1125
10 CoreFoundation 0x02720982 __CFMachPortPerform + 338
11 CoreFoundation 0x027bfff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
12 CoreFoundation 0x02720807 __CFRunLoopDoSource1 + 215
13 CoreFoundation 0x0271da93 __CFRunLoopRun + 979
14 CoreFoundation 0x0271d350 CFRunLoopRunSpecific + 208
15 CoreFoundation 0x0271d271 CFRunLoopRunInMode + 97
16 GraphicsServices 0x030bd00c GSEventRunModal + 217
17 GraphicsServices 0x030bd0d1 GSEventRun + 115
18 UIKit 0x002eeaf2 UIApplicationMain + 1160
19 NeighborMe 0x00002818 main + 102
20 NeighborMe 0x000027a9 start + 53
21 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
There is NSMutableArray in this code... so how is this possible?
You have an empty array. You tried to call [array objectAtIndex:0]. 0 is beyond the bounds of an empty array (not surprising – anything is beyond the bounds for an empty array).
It means that early in [NeighborMapViewController regionFromLocations] you are attempting to index an NSMutableArray object. That array has zero elements in it -- it's empty. But you're apparently trying to access index 0, which would be the first element. Since there is no first element, you get an exception.
Probably the code that you expect to have executed to add items to the array has not yet executed, or you simply need to check the length of the array prior to trying to access the element at index 0. It's hard to say without knowing more about what you're doing.
gdb reports the offset as 65 bytes in to the function, so it's likely in one of the first few lines. You could probably manually inspect the code of the function to see, or set a breakpoint on the first line of the function and step through it.
I was seeing this error, however, not as an exception but only in the Issue Navigator. The solution was to simply restart XCode, then the error was gone.
As Kevin Ballard said, this error is thrown when you ask for the element at index X that is beyond array bounds, in addition to looking for [array objectAtIndex: X], this error may be even caused from the modern syntax array[X]
We upgraded to Xcode 3.2.4 with iOS 4.1 SDK, now our tests are failing.
First because of this An internal error occurred when handling command output: -[XCBuildLogCommandInvocationSectionRecorder endMarker]: unrecognized selector sent to instance 0x201aa7200 then we used the patch suggested by apple forums (http://gist.github.com/586296) and now the test fail on the first Hamcrest assertion.
NSNumber * c1 = ...
NSNumber * c2 = ...
assertThat(c1, is(c2))
Here's the log:
-[NSCFNumber conformsToProtocol:]: unrecognized selector sent to instance 0x2116890
2010-09-30 22:10:23.153 otest[21063:903] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber conformsToProtocol:]: unrecognized selector sent to instance 0x2116890'
*** Call stack at first throw:
(
0 CoreFoundation 0x004e3b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x002d840e objc_exception_throw + 47
2 CoreFoundation 0x004e56ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x004552b6 ___forwarding___ + 966
4 CoreFoundation 0x00454e72 _CF_forwarding_prep_0 + 50
5 OCHamcrest 0x00ccd17b HC_wrapInMatcher + 52
6 OCHamcrest 0x00ccb4e1 HC_is + 41
7 UnitTests 0x030870c9 -[MyTest testMethod] + 141
8 CoreFoundation 0x004545cd __invoking___ + 29
9 CoreFoundation 0x004544a1 -[NSInvocation invoke] + 145
10 SenTestingKit 0x2010464a -[SenTestCase invokeTest] + 69
11 SenTestingKit 0x20104d1f -[SenTestCase performTest:] + 192
12 SenTestingKit 0x2010444b -[SenTest run] + 88
13 SenTestingKit 0x20106fa7 -[SenTestSuite performTest:] + 115
14 SenTestingKit 0x2010444b -[SenTest run] + 88
15 SenTestingKit 0x20106fa7 -[SenTestSuite performTest:] + 115
16 SenTestingKit 0x2010444b -[SenTest run] + 88
17 SenTestingKit 0x20106871 +[SenTestProbe runTests:] + 174
18 otest 0x000023b3 0x0 + 9139
19 otest 0x000025de 0x0 + 9694
20 otest 0x00002086 0x0 + 8326
21 otest 0x00002035 0x0 + 8245
22 ??? 0x00000003 0x0 + 3
)
terminate called after throwing an instance of 'NSException'
/Developer/Xcode3.2.4/Tools/RunPlatformUnitTests.include: line 415: 21063 Abort trap "${THIN_TEST_RIG}" "${OTHER_TEST_FLAGS}" "${TEST_BUNDLE_PATH}"
/Developer/Xcode3.2.4/Tools/RunPlatformUnitTests.include:451: error: Test rig '/Developer/Xcode3.2.4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/Developer/usr/bin/otest' exited abnormally with code 134 (it may have crashed).
Any one see that before? it was working perfectly on 3.1.3 SDK.
This is fixed, by using the latest OCHamcrest as a static library instead of a framework and add -lstdc++ to other linker flags.
Hope that save someone time.
I'm used to Java programming where an error is thrown and it tells you at what line the error was thrown from which file. But with Objective-C in XCode, I can't ever tell where the error comes from. How can I figure out where the error came from? Here is an example of a crash error:
2011-01-04 10:36:31.645 TestGA[69958:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array'
*** Call stack at first throw:
(
0 CoreFoundation 0x01121be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x012765c2 objc_exception_throw + 47
2 CoreFoundation 0x011176e5 -[__NSArrayM objectAtIndex:] + 261
3 TestGA 0x000548d8 -[S7GraphView drawRect:] + 5763
4 UIKit 0x003e16eb -[UIView(CALayerDelegate) drawLayer:inContext:] + 426
5 QuartzCore 0x00ec89e9 -[CALayer drawInContext:] + 143
6 QuartzCore 0x00ec85ef _ZL16backing_callbackP9CGContextPv + 85
7 QuartzCore 0x00ec7dea CABackingStoreUpdate + 2246
8 QuartzCore 0x00ec7134 -[CALayer _display] + 1085
9 QuartzCore 0x00ec6be4 CALayerDisplayIfNeeded + 231
10 QuartzCore 0x00eb938b _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 325
11 QuartzCore 0x00eb90d0 _ZN2CA11Transaction6commitEv + 292
12 QuartzCore 0x00ee97d5 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
13 CoreFoundation 0x01102fbb __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
14 CoreFoundation 0x010980e7 __CFRunLoopDoObservers + 295
15 CoreFoundation 0x01060bd7 __CFRunLoopRun + 1575
16 CoreFoundation 0x01060240 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x01060161 CFRunLoopRunInMode + 97
18 GraphicsServices 0x01932268 GSEventRunModal + 217
19 GraphicsServices 0x0193232d GSEventRun + 115
20 UIKit 0x003b842e UIApplicationMain + 1160
21 TestGA 0x00001cd8 main + 102
22 TestGA 0x00001c69 start + 53
23 ??? 0x00000001 0x0 + 1
So from looking at this, where is the error coming from and from which class is it coming from?
2 CoreFoundation 0x011176e5 -[__NSArrayM objectAtIndex:] + 261
An array you are using with that method is out of range.. In this case the array is empty and you try to get a value from a point that doesn't exist..
But i agree with you that it is pretty hard to find.. If you use the [white and yellow]-button next to the button you use to open the console you can check the debugger.. This way you can click on the " 2 CoreFoundation 0x011176e5 -[__NSArrayM objectAtIndex:] + 261" and see where it goes wrong..
It might be a good idea to refer to the Xcode debugging guide at Apple.com to learn more about how to debug your iOS applications.