[NSPlaceholderString initWithString:]: nil argument on jail break device

1

I tried with many search with the above title and also do as many advice of my search but cannot solved the problem. My app got crash when I build on the iPad which had jail break. But with the device not jail break it worked. Call the below function is the reason for crash:

-(void)btnLoginPressed:(id)sender {
    [[MoboAccesstoken ActiveAccessToken] setMoboAccessTokenDelegate:self];
    if (![[MoboAccesstoken ActiveAccessToken]isOpened]){
        [MoboSDK openActiveSessionWithCompletion:^(NSDictionary *data) {
            NSLog(@"data: %@", data);
        }];
    }
}

and the stack trace is:

2014-06-05 13:11:39.749 g1[1687:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithString:]: nil argument'
*** First throw call stack:
(0x355e988f 0x3320d259 0x355e9789 0x355e97ab 0x3499d4c9 0x71af33 0x71cb3f 0x71b893 0x71c8bf 0x1ae2f9 0x2c619f 0x4054ef 0x15dea3 0xca883 0xcf5ab 0x558dcd 0x6a73cd 0x2a5a9f 0x30399f 0x4ba2bb 0x4ba365 0x4ab929 0x4abd4b 0x4abd71 0x2c50fd 0x334c47 0x32d0392b 0x32d03319 0x32ce9695 0x32ce8f3b 0x332db22b 0x355bd523 0x355bd4c5 0x355bc313 0x3553f4a5 0x3553f36d 0x332da439 0x32d17cd5 0xa1167 0x99de8)
terminate called throwing an exception

The image of crash log:

Incident Identifier: 0F14065E-394E-43C4-8B6C-007CF55EDAEA
CrashReporter Key:   975f6d2f7ff682cc1bad50cfed0e860f0502f830
Hardware Model:      iPad1,1
Process:         TestMoboSDK-Client [294]
Path:            /var/mobile/Applications/077E9D1E-0594-45F1-8A23-154B630B8FDB/TestMoboSDK-Client.app/TestMoboSDK-Client
Identifier:      TestMoboSDK-Client
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2014-06-05 18:38:04.276 +0700
OS Version:      iPhone OS 5.1.1 (9B206)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x357d688f __exceptionPreprocess + 163
1   libobjc.A.dylib                 0x333fa259 objc_exception_throw + 32
2   CoreFoundation                  0x357d6789 +[NSException raise:format:arguments:] + 100
3   CoreFoundation                  0x357d67ab +[NSException raise:format:] + 34
4   Foundation                      0x34b8a4c9 -[NSPlaceholderString initWithString:] + 92
5   TestMoboSDK-Client              0x000f4921 0xe8000 + 51489
6   TestMoboSDK-Client              0x000f05c1 0xe8000 + 34241
7   TestMoboSDK-Client              0x000f4283 0xe8000 + 49795
8   UIKit                           0x3310360b _UIXXRemoteNotificationRegistrationSucceeded + 146
9   UIKit                           0x331040dd _XRemoteNotificationRegistrationSucceeded + 116
10  AppSupport                      0x33ce5af9 migHelperRecievePortCallout + 148
11  CoreFoundation                  0x357aa523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 38
12  CoreFoundation                  0x357aa4c5 __CFRunLoopDoSource1 + 140
13  CoreFoundation                  0x357a9313 __CFRunLoopRun + 1370
14  CoreFoundation                  0x3572c4a5 CFRunLoopRunSpecific + 300
15  CoreFoundation                  0x3572c36d CFRunLoopRunInMode + 104
16  GraphicsServices                0x334c7439 GSEventRunModal + 136
17  UIKit                           0x32f04cd5 UIApplicationMain + 1080
18  TestMoboSDK-Client              0x000f6c0f 0xe8000 + 60431
19  TestMoboSDK-Client              0x000ee008 0xe8000 + 24584


Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x3584c32c __pthread_kill + 8
1   libsystem_c.dylib               0x34a34208 pthread_kill + 48
2   libsystem_c.dylib               0x34a2d298 abort + 88
3   libc++abi.dylib                 0x35044f64 abort_message + 40
4   libc++abi.dylib                 0x35042346 default_terminate() + 18
5   libobjc.A.dylib                 0x333fa350 _objc_terminate + 140
6   libc++abi.dylib                 0x350423be safe_handler_caller(void (*)()) + 70
7   libc++abi.dylib                 0x3504244a std::terminate() + 14
8   libc++abi.dylib                 0x3504381e __cxa_rethrow + 82
9   libobjc.A.dylib                 0x333fa2a2 objc_exception_rethrow + 6
10  CoreFoundation                  0x3572c506 CFRunLoopRunSpecific + 398
11  CoreFoundation                  0x3572c366 CFRunLoopRunInMode + 98
12  GraphicsServices                0x334c7432 GSEventRunModal + 130
13  UIKit                           0x32f04cce UIApplicationMain + 1074
14  TestMoboSDK-Client              0x000f6c08 0xe8000 + 60424
15  TestMoboSDK-Client              0x000ee000 0xe8000 + 24576

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib          0x3583c3a8 kevent + 24
1   libdispatch.dylib               0x33b6fea4 _dispatch_mgr_invoke + 708
2   libdispatch.dylib               0x33b6fbc2 _dispatch_mgr_thread + 30

Thread 2:
0   libsystem_kernel.dylib          0x3584ccd4 __workq_kernreturn + 8
1   libsystem_c.dylib               0x349eff36 _pthread_wqthread + 610
2   libsystem_c.dylib               0x349efcc8 start_wqthread + 0

Thread 3 name:  WebThread
Thread 3:
0   libsystem_kernel.dylib          0x3584c0d8 __psynch_mutexwait + 24
1   libsystem_c.dylib               0x349e9674 pthread_mutex_lock + 376
2   WebCore                         0x373cf4e8 _WebTryThreadLock(bool) + 208
3   WebCore                         0x373cf7ec WebRunLoopLock(__CFRunLoopObserver*, unsigned long, void*) + 24
4   CoreFoundation                  0x357aab14 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 12
5   CoreFoundation                  0x357a8d50 __CFRunLoopDoObservers + 252
6   CoreFoundation                  0x357a916a __CFRunLoopRun + 946
7   CoreFoundation                  0x3572c49e CFRunLoopRunSpecific + 294
8   CoreFoundation                  0x3572c366 CFRunLoopRunInMode + 98
9   WebCore                         0x37472c9c RunWebThread(void*) + 396
10  libsystem_c.dylib               0x349f572e _pthread_start + 314
11  libsystem_c.dylib               0x349f55e8 thread_start + 0

Thread 4:
0   libsystem_kernel.dylib          0x3584ccd4 __workq_kernreturn + 8
1   libsystem_c.dylib               0x349eff36 _pthread_wqthread + 610
2   libsystem_c.dylib               0x349efcc8 start_wqthread + 0

Thread 5 name:  com.apple.NSURLConnectionLoader
Thread 5:
0   libsystem_kernel.dylib          0x3583c004 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3583c1fa mach_msg + 50
2   CoreFoundation                  0x357aa3ec __CFRunLoopServiceMachPort + 120
3   CoreFoundation                  0x357a9124 __CFRunLoopRun + 876
4   CoreFoundation                  0x3572c49e CFRunLoopRunSpecific + 294
5   CoreFoundation                  0x3572c366 CFRunLoopRunInMode + 98
6   Foundation                      0x34b71bb2 +[NSURLConnection(Loader) _resourceLoadLoop:] + 302
7   Foundation                      0x34b71a7a -[NSThread main] + 66
8   Foundation                      0x34c0558a __NSThread__main__ + 1042
9   libsystem_c.dylib               0x349f572e _pthread_start + 314
10  libsystem_c.dylib               0x349f55e8 thread_start + 0

Thread 6:
0   libsystem_kernel.dylib          0x3584ccd4 __workq_kernreturn + 8
1   libsystem_c.dylib               0x349eff36 _pthread_wqthread + 610
2   libsystem_c.dylib               0x349efcc8 start_wqthread + 0

Thread 0 crashed with ARM Thread State:
    r0: 0x00000000    r1: 0x00000000      r2: 0x00000001      r3: 0x00000000
    r4: 0x00000006    r5: 0x3f0f8d98      r6: 0x00000002      r7: 0x2fee39a8
    r8: 0x00000000    r9: 0x35045a4a     r10: 0x0014a888     r11: 0x333f4f69
    ip: 0x00000148    sp: 0x2fee399c      lr: 0x34a3420f      pc: 0x3584c32c
  cpsr: 0x00000010

Edit: The crash only happen on iPad(jail break) 5.1.1. With iPad(jail break) 7.0.4 or 6. -> it worked.*

Reason: When I call openActiveSessionWithCompletion function,I do many actions to collect the info to make a url link. It included the action: get UUIDString .And with iOS 5.1 the result when get UUIDString is a NULL string. So that, it's reason for app crash when I call the command: uuid_String = [[NSString alloc]initWithString:[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]];. initWithString: this function when push a NULL string will make app crash.

ios
objective-c
ipad
jailbreak
asked on Stack Overflow Jun 5, 2014 by lee • edited Jun 6, 2014 by lee

1 Answer

1

This is wrong:

uuid_String = [[NSString alloc]initWithString:[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]]

Just do this:

uuid_String = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];

As for why it returns nil, probably because advertising is disabled on the device. Users are allowed to opt out of tracking.

Check the documentation and beware iOS 5 and 7 have different behaviour.

answered on Stack Overflow Jun 6, 2014 by Abhi Beckert

User contributions licensed under CC BY-SA 3.0