AddressBook plugin crash on iOS 9

Hi,

When I use the Adressbook plugin on iOS9, it crashes every time I pick a contact with a ‘linked contact’ (see image)

addressbook_problem.png

This doesn’t happen when I use it on iOS8 or below.

the code I use is fairly simple:

[lua]local contact_params = {
option = “pickContact”,
hideDetails = true,
– performDefaultAction = false,
listener = onContactsComplete
}

native.showPopup( “addressbook”, contact_params )[/lua]

Even without a listener, the app crashes completely on iOS 9 after I select a contact.

Is there a solution for this crash? Thanks,

Arthur 

Hi @OCG Studios,

Can you please gather a crash report (if at all possible) and submit a bug report? We’ll have to explore why this is happening and what changed in iOS 9 which may be causing it.

https://developer.coronalabs.com/content/bug-submission

Thanks,

Brent

I’ll do that

Hi @OCG Studios,

Can you please gather a crash report (if at all possible) and submit a bug report? We’ll have to explore why this is happening and what changed in iOS 9 which may be causing it.

https://developer.coronalabs.com/content/bug-submission

Thanks,

Brent

I’ll do that

I am seeing this issue too.

I would very much like to use the addressbook plugin in my app, but as it is now it is useless.

@OCG did you submit the bug report?

It appears this is a permission bug introduced by apple in iOS 9.

https://openradar.appspot.com/23006507

Could coronalabs apply the workaround mentioned here?

https://forums.developer.apple.com/thread/11354

@ojnab, I’ve submitted a bugreport last november. 

@OCG thanks then I don’t need to do it.

I guess there isn’t a lot of people using the addressbook plugin since this is getting no attention at all.

Wish someone at CL would take a look at it. It should be fairly simple to fix. 

I fixed this issue a couple of weeks ago.

I wasn’t aware that this thread existed, so my apologies for not replying.

Great. Thanks Danny.

I just tested the plugin and it is still not working for me.

I tested with the addressbook samplecode built for iOS 9.2 with db 2860.

It crashes every time I pick a contact with a ‘linked contact’

Below is my console output when it crashes.

Apr&nbsp; 7 15:05:46 jacobs-iPhone addressbook[941] \<Error\>: \*\*\* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'A contact and its snapshot should both be non-unified.' \*\*\* First throw call stack: (0x18414ae38 0x1837aff80 0x18414ad80 0x18b4d81e4 0x18b4d7e0c 0x18b514ac0 0x18b4e2224 0x18ca9bd3c 0x18c1cff48 0x18c255204 0x18c2559e0 0x183b954bc 0x183b9547c 0x183b9ab84 0x184100dd8 0x1840fec40 0x184028d10 0x185910088 0x1892fdf70 0x10002f518 0x183bc68b8) Apr&nbsp; 7 15:05:46 jacobs-iPhone SpringBoard[54] \<Warning\>: HW kbd: Failed to set com.apple.MobileAddressBook.ContactsViewService as keyboard focus Apr&nbsp; 7 15:05:46 jacobs-iPhone com.apple.xpc.launchd[1] (UIKitApplication:com.ojnab.addressbook[0x5234][941]) \<Notice\>: Service exited due to signal: Abort trap: 6 Apr&nbsp; 7 15:05:46 jacobs-iPhone ContactsViewService[942] \<Warning\>: host connection \<NSXPCConnection: 0x155d3a7f0\> connection from pid 941 invalidated Apr&nbsp; 7 15:05:46 jacobs-iPhone ContactsViewService[942] \<Warning\>: Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (\<UISearchController: 0x155dc38d0\>) Apr&nbsp; 7 15:05:46 jacobs-iPhone diagnosticd[79] \<Error\>: unable to find offset 0x83bbb98c in shared cache for arch 'arm64' Apr&nbsp; 7 15:05:46 jacobs-iPhone ReportCrash[943] \<Notice\>: platform\_thread\_get\_unique\_id matched 380141 Apr&nbsp; 7 15:05:46 jacobs-iPhone ReportCrash[943] \<Notice\>: Formulating report for corpse[941] addressbook Apr&nbsp; 7 15:05:46 jacobs-iPhone mediaserverd[25] \<Notice\>: '' com.apple.MobileAddressBook.ContactsViewService(pid = 942) setting DiscoveryMode = DiscoveryMode\_None, currentDiscoveryMode = DiscoveryMode\_PresenceScan Apr&nbsp; 7 15:05:46 jacobs-iPhone SpringBoard[54] \<Warning\>: HW kbd: Failed to set (null) as keyboard focus Apr&nbsp; 7 15:05:46 jacobs-iPhone SpringBoard[54] \<Warning\>: Application 'UIKitApplication:com.ojnab.addressbook[0x5234]' crashed. Apr&nbsp; 7 15:05:46 jacobs-iPhone UserEventAgent[23] \<Warning\>: 1118954279444: id=com.ojnab.addressbook pid=941, state=0 Apr&nbsp; 7 15:05:46 jacobs-iPhone ReportCrash[943] \<Warning\>: Saved type '109(109\_addressbook)' report (3 of max 25) at /var/mobile/Library/Logs/CrashReporter/addressbook-2016-04-07-150546.ips

This must be a separate issue than the one I fixed then. My apologies.

I’ll look into this today

Yes I think you are right about that.

I seem to remember seeing another crash report than this one.

Thanks. 

Just to be 100% clear… It crashes when a linked contact is selected, no matter what service the linked contact is tied to correct? (i.e iCloud, Facebook etc)

Thanks

Not sure… the only type of linked contacts I have in my phone is “iPhone”

It crashes when I select that.

If I select a contact with no linked contacts it works as supposed to.

That gives me enough to work off.

I’ll update this thread when i’ve got more info.

Thank you. 

Any progress on fixing the addressbook plugin Danny?

Thanks, Nail

Sorry for the delay, been swamped.

Just started looking into this and can reproduce the crash.

I’ll update when I figure out the cause.

Thanks for your patience

Great news Danny!

I’ve got 3 apps that use the AddressBook plugin that can’t be updated without a fix.

Thanks again,

Nail