0

I am having a issue where my app runs fine when I run it through Xcode but crashes when I launch it manually. I have gone through a lot of posts on SO, but I couldn't find any specific answer. I checked the device log, here is a snippet which I think is the cause of the crash:

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libobjc.A.dylib                 0x0000000180ff5b9c objc_msgSend +28
1   AppSupport                      0x0000000183159f0c _updateDetachedRecord + 32
2   AppSupport                      0x0000000183159ffc CPRecordGetProperty + 52
3   AppSupport                      0x000000018315a270 CPRecordCopyProperty + 24
4   AddressBook                     0x0000000187774498 ABRecordCopyValueUnfiltered + 68
5   AddressBook                     0x00000001877743bc ABRecordCopyValue + 68

I am trying to access my address book and fetch a contacts details (whichever the user clicks on) and then display it in a pop-over. Here is a snippet of the code:

NSString *firstName = (__bridge NSString *) ABRecordCopyValue(person, kABPersonFirstNameProperty);
NSString *lastName = (__bridge NSString *) ABRecordCopyValue(person, kABPersonLastNameProperty);
NSString *company = (__bridge NSString *) ABRecordCopyValue(person, kABPersonOrganizationProperty);
NSString *title = (__bridge NSString *) ABRecordCopyValue(person, kABPersonPrefixProperty);
ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);
NSString *email = (__bridge NSString *)(ABMultiValueCopyValueAtIndex(emails, 0));
ABMultiValueRef phoneNo = ABRecordCopyValue(person, kABPersonPhoneProperty);
NSString *phnNo = (__bridge NSString *)(ABMultiValueCopyValueAtIndex(phoneNo, 0));
ABMultiValueRef skyepeIDs = ABRecordCopyValue(person, kABPersonInstantMessageProperty);
NSDictionary *skyepeID = (__bridge NSDictionary *)(ABMultiValueCopyValueAtIndex(skyepeIDs, 0));

P.S: The app runs completely fine when I run it via Xcode.

4
  • 1
    try to turn off the Swift compiler optimisations for the release build in build settings under under Swift Compiler/Code Generation and if still there then try to turn of the whole module optimization as well Commented Jul 29, 2016 at 5:03
  • 1
    Are You fetching address book At launch time .? Commented Jul 29, 2016 at 5:10
  • or Doing something else process at launch time ? Commented Jul 29, 2016 at 5:15
  • No i am fetching it later, the app doesn't crash on launch, it crashes when i select a contact. Commented Jul 29, 2016 at 5:18

1 Answer 1

2

There are lots of reason for crashing the app at release mode but what i faced it was due to Compiler Optimisation, i just trued it off then everything worked fine for me. As per the docs Swift complier is still in beta version so may be there can be lots of minor issues. but this is related to the Swift Optimiser and that’s fine you can release without the optimisation just update it timely and see is the issue still there if not then go with optimisation. (i do’t have the question thread as i learned it somewhere from SO, let me search).

enter image description here

NOTE But yes, that's for sure. there is some lines of code that Swift Optimisation is not able to optimise. so try to find it out so it will be really great for everyone here.

Sign up to request clarification or add additional context in comments.

6 Comments

I turned it off from Build Settings -> Apple LLVM 7.1- Code Generation, so both debug and release were set to None[-Oo], but it didn't help.
Build Settings -> Swift Complier - Code Generation -> Optimisation Level.
There is no, Swift Complier - Code Generation under Build Settings. Btw i am not using Swift, so how does this help ? Sorry i am a noobie.
7.3.1, i looked up and it looks like i have to add a swift file to the project to get that option, will that help if my code doesn't have swift code in it ?
Finally i fixed it !! The issue was with a method call which was messed by one of my seniors where he added a additional parameter to a existing method, i was nervous when he was doing that but couldn't say anything, i went back to the previous implementation and it works fine. Thanks for your time :)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.