UnityReportWWWFinishedLoadingData Xcode crash - unity3d

I have been stuck on this issue for the last two days. I'm using Unity 5.2.3f1 and calling a URL through WWW(URL) class. The URL uses https so it is SSL secured. The file that I'm retrieving is a simple plist file that I've placed in my dropbox account. The call is made inside a coroutine and the result is expected in a yield statement. I've also added App Allow Transport Property in Info.plist file and allowed Arbitrary Loads true in it.
However whenever I try to retrieve the data, my app crashes halting at FeedUnityWebStream after UnityReportWWWFinishedLoadingData.
Crash log is as following:
Setting up 1 worker threads for Enlighten.
Thread -> id: 16e677000 -> priority: 1
2015-11-30 15:53:58.278 3dgymnastics[1029:280327] -[NSMallocBlock bytes]: unrecognized selector sent to instance 0x13898d260
2015-11-30 15:53:58.368 3dgymnastics[1029:280327] Uncaught exception: NSInvalidArgumentException: -[NSMallocBlock bytes]: unrecognized selector sent to instance 0x13898d260
(
0 CoreFoundation 0x0000000185b7cf60 + 148
1 libobjc.A.dylib 0x000000019a63ff80 objc_exception_throw + 56
2 CoreFoundation 0x0000000185b83c5c + 0
3 CoreFoundation 0x0000000185b80c00 + 872
4 CoreFoundation 0x0000000185a84cac _CF_forwarding_prep_0 + 92
5 3dgymnastics 0x000000010043fe08 _ZN3WWW18FeedUnityWebStreamEb + 104
6 3dgymnastics 0x00000001006796a8 UnityReportWWWFinishedLoadingData + 68
7 CFNetwork 0x000000018540f6a8 + 80
8 CFNetwork 0x000000018540f638 + 200
9 CFNetwork 0x000000018540f7ac + 56
10 CFNetwork 0x000000018527b4fc + 100
11 CFNetwork 0x0000000185369b38 + 108
12 libdispatch.dylib 0x0000000101e7dc68 _dispatch_client_callout + 16
13 libdispatch.dylib 0x0000000101e8740c _dispatch_block_invoke + 564
14 CFNetwork 0x0000000185267ce4 + 36
15 CoreFoundation 0x0000000185a606cc CFArrayApplyFunction + 68
16 CFNetwork 0x0000000185267bc8 + 136
17 CFNetwork 0x0000000185267a88 + 312
18 CFNetwork 0x00000001852678b4 + 68
19 CoreFoundation 0x0000000185b34544 + 24
20 CoreFoundation 0x0000000185b33f58 + 412
21 CoreFoundation 0x0000000185b31cd8 + 724
22 CoreFoundation 0x0000000185a60ca0 CFRunLoopRunSpecific + 384
23 GraphicsServices 0x0000000190c9c088 GSEventRunModal + 180
24 UIKit 0x000000018b178ffc UIApplicationMain + 204
25 3dgymnastics 0x0000000100053100 main + 144
26 libdyld.dylib 0x000000019ae8e8b8 + 4
)
2015-11-30 15:53:58.369 3dgymnastics[1029:280327] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSMallocBlock__ bytes]: unrecognized selector sent to instance 0x13898d260'
* First throw call stack:
(0x185b7cf48 0x19a63ff80 0x185b83c5c 0x185b80c00 0x185a84cac 0x10043fe08 0x1006796a8 0x18540f6a8 0x18540f638 0x18540f7ac 0x18527b4fc 0x185369b38 0x101e7dc68 0x101e8740c 0x185267ce4 0x185a606cc 0x185267bc8 0x185267a88 0x1852678b4 0x185b34544 0x185b33f58 0x185b31cd8 0x185a60ca0 0x190c9c088 0x18b178ffc 0x100053100 0x19ae8e8b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
I know the problem is related to security settings recently introduced by Apple in iOS9. The work around I have been using till now is by adding NSAppTransportSecurity. However it just won't work anymore. Need help in the matter.
My Unity version is 5.2.3 and Xcode is 7.1.

Not sure if this is the correct approach but I finally managed to get it working. I was turning ARC setting off to allow few files with retain. Something I should never have done since a simple separate flags for these files in Build Phases can get it done. On turning ARC back on, the rest of the program worked without errors. Newbie or rookie mistake to make. Unity5 onwards turns on ARC by default. I guess a lot depends on it in exported Xcode project. Hopefully this helps someone if they encounter something similar.

Related

SIGABRT with Xcode using Swift

So something happened with my Xcode where I continuously keep getting Thread 1 SIGABRT error.
I have literally tried what every message board has suggested, and don't know where to turn to next. I know its not an issue with outlets, because I ensured there was no outlet on the storyboard. I tried opening past projects (which worked perfectly fine in the past) but they too crashed with this error. It seems like there is something wrong with Xcode itself. It will always crash any project that has any elements on the storyboard.
Could anyone help and make sense of this?
2016-08-17 18:58:58.482 wazSUP[2002:41440] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Can't set default ACL before Parse is initialized.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010e6f1d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000110624deb objc_exception_throw + 48
2 CoreFoundation 0x000000010e6f1cbd +[NSException raise:format:] + 205
3 wazSUP 0x000000010dd40f5a +[PFACL setDefaultACL:withAccessForCurrentUser:] + 175
4 wazSUP 0x000000010dd35bf1 _TFC6wazSUP11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryCSo8NSObjectPs9AnyObject____Sb + 401
5 wazSUP 0x000000010dd362a4 _TToFC6wazSUP11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryCSo8NSObjectPs9AnyObject____Sb + 180
6 UIKit 0x000000010f09f9ac -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272
7 UIKit 0x000000010f0a0c0d -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415
8 UIKit 0x000000010f0a7568 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1769
9 UIKit 0x000000010f0a4714 -[UIApplication workspaceDidEndTransaction:] + 188
10 FrontBoardServices 0x0000000111c7c8c8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
11 FrontBoardServices 0x0000000111c7c741 -[FBSSerialQueue _performNext] + 178
12 FrontBoardServices 0x0000000111c7caca -[FBSSerialQueue _performNextFromRunLoopSource] + 45
13 CoreFoundation 0x000000010e617301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x000000010e60d22c __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x000000010e60c6e3 __CFRunLoopRun + 867
16 CoreFoundation 0x000000010e60c0f8 CFRunLoopRunSpecific + 488
17 UIKit 0x000000010f0a3f21 -[UIApplication _run] + 402
18 UIKit 0x000000010f0a8f09 UIApplicationMain + 171
19 wazSUP 0x000000010dd36f22 main + 114
20 libdyld.dylib 0x000000011112b92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Ok, I have not seen your code so I do not know exactly what to do to fix it but I can explain Thread 1 SIGABRT to you.
The bug can be caused in 2 ways:
If you have the code for an IBOUTLET but deleted the connection from the view controller to the program or Vice Versa it will cause the bug
Also doing self.addChild(nodeName) multiple times to the same node without removing between the 2 occurrences can cause it as well.
Hope this helped.

iPad App crashes only when it is launched manually (from springboard). Memory issue suspected

I have been trying to solve this problem for 2 days now and it is driving me crazy. When Xcode launches the app it works fine, but If I manually launch the app from Springboard it crashes. The console prints out this:
Jan 20 15:26:29 unknown UIKitApplication:com.yourcompany.ThinClient[0x28cf][1119] <Notice>: ThinClient(1119,0x3db0000) malloc: *** error for object 0x643434: incorrect checksum for freed object - object was probably modified after being freed.
Jan 20 15:26:29 unknown UIKitApplication:com.yourcompany.ThinClient[0x28cf][1119] <Notice>: *** set a breakpoint in malloc_error_break to debug
Jan 20 15:26:29 unknown ThinClient[1119] <Error>: ThinClient(1119,0x3db0000) malloc: *** error for object 0x643434: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
The stack for the crashed thread (usually) looks like this, although sometimes it crashes in different spots:
Thread 5 Crashed:
0 libsystem_kernel.dylib 0x33d4da1c __pthread_kill + 8
1 libsystem_c.dylib 0x353523b4 pthread_kill + 52
2 libsystem_c.dylib 0x3534abf8 abort + 72
3 libsystem_c.dylib 0x3535e822 szone_error + 210
4 libsystem_c.dylib 0x3535e920 free_list_checksum_botch + 16
5 libsystem_c.dylib 0x35361722 tiny_malloc_from_free_list + 82
6 libsystem_c.dylib 0x35361e76 szone_malloc_should_clear + 166
7 libsystem_c.dylib 0x35362fd4 szone_malloc + 4
8 libsystem_c.dylib 0x35386230 malloc_zone_malloc + 48
9 libsystem_c.dylib 0x35386c2c malloc + 28
10 ThinClient 0x0000590c -[MySocket readBytes:] (MySocket.m:231)
11 ThinClient 0x00007b7e -[ThinServerTalker onSocket:readCallbackBytesWaiting:] (ThinServerTalker.m:362)
12 ThinClient 0x000057e2 ReadDataCB (MySocket.m:201)
13 CoreFoundation 0x33cca48a __CFSocketDoCallback + 334
14 CoreFoundation 0x33ccb4a2 __CFSocketPerformV0 + 78
15 CoreFoundation 0x33cc5a72 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
16 CoreFoundation 0x33cc7758 __CFRunLoopDoSources0 + 376
17 CoreFoundation 0x33cc84e4 __CFRunLoopRun + 224
18 CoreFoundation 0x33c58ebc CFRunLoopRunSpecific + 224
19 CoreFoundation 0x33c9b6d2 CFRunLoopRun + 42
20 ThinClient 0x00005656 -[MySocket _connect] (MySocket.m:160)
21 Foundation 0x33d71382 -[NSThread main] + 38
22 Foundation 0x33de35c6 __NSThread__main__ + 966
23 libsystem_c.dylib 0x3535230a _pthread_start + 242
24 libsystem_c.dylib 0x35353bb4 thread_start + 0
I suspect its from the application writing to memory that has already been freed, so I have already tried a few things:
I tried debugging the app with guard malloc, scribble, guard edges, zombie objects, malloc stack, etc..
I tried going to the code where the app crashed and finding an issue there ( i do not believe there is an issue there because the app crashes at different places, but they are all near each other)
I tried going through and commenting out all of my free() function calls.
I still have not found the problem! If anybody could please shed some light on this it would be much appreciated! Thanks! Any Suggestions?
Edit: The app will crash every time if it is launched from springboard, but if Xcode launches it, it will work fine.
I found the issue. I was returning a direct pointer to the bytes in a NSData object from a function. I simply replaced a function called "-(char*)getBytes" with a function called "-(NSData*)getDataCopy". Get data copy instead returns an autoreleased copy of the data class.
To reiterate:
I had this:
-(char*)getBytes{
return _data.bytes;}
and I replaced it with this
-(NSData*)getDataCopy{
return [NSData dataWithData:_data];
}
The issue was I was writing to memory that had already been released.

Crash on [NSURLConnection releaseDelegate] in a function without NSURLConnections, how do I culprit?

Hullo,
I am experimenting a very vicious crash that shows up in the following way in the device logs:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x50000008
Crashed Thread: 0`
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x33b24c98 objc_msgSend + 16
1 Foundation 0x3429465a _NSURLConnectionReleaseClient + 30
2 CFNetwork 0x355ac608 ClientContextHolder<CFURLConnectionClient_V4>::forget() + 20
3 CFNetwork 0x355ac5ea URLConnectionClient::releaseClientLocked() + 34
4 CFNetwork 0x355a0e9a URLConnectionClient::processEvents() + 170
5 CFNetwork 0x355a0de2 URLConnection::multiplexerClientPerform(RunLoopMultiplexer*) + 30
6 CFNetwork 0x355a0d54 MultiplexerSource::perform() + 120
7 CFNetwork 0x355a0cd2 MultiplexerSource::_perform(void*) + 2
8 CoreFoundation 0x3039ca72 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
9 CoreFoundation 0x3039e758 __CFRunLoopDoSources0 + 376
10 CoreFoundation 0x3039f4e4 __CFRunLoopRun + 224
11 CoreFoundation 0x3032febc CFRunLoopRunSpecific + 224
12 CoreFoundation 0x3032fdc4 CFRunLoopRunInMode + 52
13 GraphicsServices 0x35571418 GSEventRunModal + 108
14 GraphicsServices 0x355714c4 GSEventRun + 56
15 UIKit 0x358c7d62 -[UIApplication _run] + 398
16 UIKit 0x358c5800 UIApplicationMain + 664
17 inArrivo 0x000023ca main (main.m:14)
18 inArrivo 0x00002394 start + 32
After having enabled NSZombie I also have a crash on the compiler log of the following form:
2011-05-09 16:12:24.400 inArrivo[5019:707] * -[NSURLConnection releaseDelegate]: message sent to deallocated instance 0x5d61670
appearing on the app main with the last NSLog comeing from a function with no url connections. Also if I remove some pieces of very innocent code from that function, no crash occurs, and the same happens when I run the complete application on the simulator.
Could someone give me some hints about what I may do to locate the piece of code producing the crash? Normal debugging of course is of little help here.
Thanks,
Fabrizio Bartolomucci
The message indicates that the delegate for NSURLConnection was deallocated. I would suggest you check the delegate object to see if you are doing an extra release on it.

Unit Tests Failure At Xcode 3.2.4, iOS 4.1 SDK Using Hamcrest Assertion

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.

Terminating app due to uncaught exception 'NSInvalidArgumentException'

I am using ShareKit to allow the user to share their score on Twitter and Facebook in my iPhone app. However, it seems to crash shortly after sharing on either service. I get an console message which says:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString rangeOfString:options:range:locale:]: nil argument'
*** Call stack at first throw:
(
0 CoreFoundation 0x026d6919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x028245de objc_exception_throw + 47
2 CoreFoundation 0x0268f078 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x0268efea +[NSException raise:format:] + 58
4 Foundation 0x0008f97b -[NSString rangeOfString:options:range:locale:] + 424
5 Foundation 0x0009de16 -[NSString rangeOfString:] + 104
6 iPhone Typer 0x00030220 -[SHKOAuthView webView:shouldStartLoadWithRequest:navigationType:] + 151
7 UIKit 0x004bb456 -[UIWebView webView:decidePolicyForNavigationAction:request:frame:decisionListener:] + 458
8 CoreFoundation 0x0264742d __invoking___ + 29
9 CoreFoundation 0x02647301 -[NSInvocation invoke] + 145
10 WebCore 0x030940f0 _ZL20HandleDelegateSourcePv + 64
11 CoreFoundation 0x026b7d7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
12 CoreFoundation 0x026162cb __CFRunLoopDoSources0 + 571
13 CoreFoundation 0x026157c6 __CFRunLoopRun + 470
14 CoreFoundation 0x02615280 CFRunLoopRunSpecific + 208
15 CoreFoundation 0x026151a1 CFRunLoopRunInMode + 97
16 GraphicsServices 0x02e5e2c8 GSEventRunModal + 217
17 GraphicsServices 0x02e5e38d GSEventRun + 115
18 UIKit 0x00339b58 UIApplicationMain + 1160
19 iPhone Typer 0x00002894 main + 102
20 iPhone Typer 0x00002825 start + 53
)
terminate called after throwing an instance of 'NSException'
How would I fix this? Thanks.
Set a breakpoint on objc_exception_throw, then build the app for debug, run the app with breakpoints on and cause the crash again, then go up the stack to the relevant code.
Something inside SHKOAuthView webView:shouldStartLoadWithRequest:navigationType: is passing a nil argument to NSString rangeOfString. When you know what is passing the nil, it may be obvious what the problem is - failing that update your question with the relevant code and any extra information you've determined.