8
votes

I've been developing an app for editing photos and I want to have an extension for the Photos app. The enxtension works perfectly on the simulator and without any problem.

But when I try to run it in my iPhone 6 I experience 2 issues:

  1. Problems with the Provisioning profiles. I know that for an extension I need a new AppID (named app.myapp.com.extension and the main AppID is app.myapp.com) and new provisioning profiles. I've created 2 new provisioning prifles (one for development and the other one for distribution) with the new AppID, but when I try to run it on the device this error appears:

error: Embedded binary is not signed with the same certificate as the parent app. Verify the embedded binary target's code sign settings match the parent app's. Embedded Binary Signing Certificate: - (Ad Hoc Code Signed) Parent App Signing Certificate: iPhone Developer: Mauro Vime (------------------)

I've regenerated the development Provisioning Profiles to check that is for development and not for Ad Hoc but I still experience the same problems.

  1. So I tried to export the ipa from the app and run it. The app runs perfect but the extension just shows a black view, instead of my view that contains the photo. Then I checked the crash logs of the phone and saw this:

Incident Identifier: 9E578D78-FAB7-419E-AB35-7BA7B0821AFA CrashReporter Key: ae6bdea47a4e64b09a8fb7fa8599b5e23ceb5311 Hardware Model: iPhone7,2 Process: extension [2598] Path:
/private/var/mobile/Containers/Bundle/Application/----------/------------/PlugIns/extension.appex/extension Identifier: app.myapp.com.extension Version: 1 (1.0) Code Type: ARM-64 (Native) Parent Process:
launchd [1] Date/Time: 2014-10-14 01:29:21.482 +0200 Launch Time: 2014-10-14 01:29:16.170 +0200 OS Version: iOS 8.1 (12B407) Report Version: 105 Exception Type: EXC_CRASH (SIGABRT) Exception Subtype: LAUNCH_HANG Exception Message: The extension took too much time to initialize Highlighted Thread: 0 Backtrace not available Unknown thread crashed with ARM Thread State (64-bit): x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000 x4: 0x0000000000000000 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x0000000000000000 x8: 0x0000000000000000 x9: 0x0000000000000000 x10: 0x0000000000000000 x11: 0x0000000000000000 x12: 0x0000000000000000 x13: 0x0000000000000000 x14: 0x0000000000000000 x15: 0x0000000000000000 x16: 0x0000000000000000 x17: 0x0000000000000000 x18: 0x0000000000000000 x19: 0x0000000000000000 x20: 0x0000000000000000 x21: 0x0000000000000000 x22: 0x0000000000000000 x23: 0x0000000000000000 x24: 0x0000000000000000 x25: 0x0000000000000000 x26: 0x0000000000000000 x27: 0x0000000000000000
x28: 0x0000000000000000 fp: 0x0000000000000000 lr: 0x0000000000000000 sp: 0x000000016fdb3b68 pc: 0x00000001200f9000 cpsr: 0x00000000 Binary Images: 0x1200f8000 - 0x12011ffff dyld arm64 /usr/lib/dyld

Here says the app was runing in a 8.1 device but I also tried it in 8.0.2 iOS and the same problem appeared. After seeing the message: "The extension took too much time to initialize", I just cleared the viewDidLoad and viewWillAppear functions so they don't execute any code but the problem persists.

Is there anyone that experienced this problems and have a solution?

3
I am also facing same problem in Custom Keyboard - Rachit
I am also facing same issue with Custom Keyboard. "The extension took too much time to initialize" - Kartik Shah
I am also facing same issue with Today Widget. "The extension took too much time to initialize". Anyone has the resolution? - scottphc

3 Answers

0
votes

Could it be that you aren't using a 64-bit architecture (required for extensions)? See the "Note about 64-bit Architecture" in Apple's App Extension Programming Guide.

0
votes

Make sure that Architectures and Valid Architectures contain arm64 and Build Active Architecture Only is No for the used configuration (debug/release).

We had Build Active Architecture Only set to Yes so Jenkins built only armv7 binary (although xcode built correct binary depending on connected device). It seems that armv7 applications works fine on arm64 devices, but armv7 app extensions fail to load with strange error "The extension took too much time to initialize". After fixing Build Active Architecture Only setting fat binary is built (armv7+arm64) and extension works fine.

0
votes

I've faced both problems:

For the code signing problem, I believe there is a bug in Xcode related to adding app extension targets. That initially messed me up and I ended up with this error. - you need to remove and regenerate the provision profiles for the app and the app extension in the Developer Center. - if you are using an app group to share information, remove from Capabilities and the Development Center and re-enable that in the Capabilities section.

For the LAUNCH_HANG problem, it appears that there is a finite and small (undocumented) window for an extension to fully load before iOS gives up on it. - review all of your code that is linked into your extension. Don't include anything you don't absolutely need.

My particular problem was when I added a podspec for my extension target. I copied the target for my main app and didn't realize that I included Flurry in the extension. Nothing wrong with Flurry, but it is a big static library that needed to be mapped into memory when the host app launched my extension. Removed that and the error has gone away.