Search code examples
xcodedebuggingios8ios-app-extension

Running iOS8 extension on simulator offers no suitable host app


When I run my ios8 action extension on the iPhone simulator it gives me a list of apps to act as host, but it only offers 'today' and my own app even though I have specified the following in NSExtensionActivationRule in the plist: NSExtensionActivationSupportsImageWithMaxCount:1 NSExtensionActivationSupportsWebURLWithMaxCount:1

so I would have expected safari, photos etc.


Solution

  • You may want to forego launching the extension directly from the simulator.

    I've been debugging extensions all week and what I'd suggest is this (not too long) process:

    1. Launch the app so that your latest version of the extension is loaded onto the simulator.
    2. Then stop the app so the simulator is not in use.
    3. Attach to the extension via this Xcode menu Item: Debug->Attach to Process->By Process Identifier (PID) or Name
    4. Xcode will now say "Waiting for 'EXTENSION NAME HERE' to start" and may prompt you to "take the appropriate action"
    5. (On the simulator) Launch Safari (or the appropriate app) and interact like you would if Xcode had launched it on your device.
    6. Once your extension is run, Xcode will attach and you can debug

    I would recommend binding that menu item to a keyboard shortcut (I used Opt-Shift-Cmd-A because I hate my carpal tunnel) because it's two items down and the stupid attach menu loads all the active process AFTER it opens so the item you want jumps to the top of the screen.

    Once you load the extension you can keep re-attaching to it if it crashes without having to relaunch the containing app.

    This has sped up my debugging process quite a bit.