3

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.

Neil Coxhead
  • 575
  • 1
  • 4
  • 10

2 Answers2

2

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.

DanBlakemore
  • 2,306
  • 2
  • 20
  • 23
  • Also, I should mention that I took that process from another post (potentially on SO), but I've read so much stuff this week that can't remember where. So if you find it on SO, upvote them and link it here so I can too. – DanBlakemore Aug 30 '14 at 23:31
1

Create action extension involves the following three steps

1) Create a Target with "Action extension" template

enter image description here

2) Goto iPhone "Photos" app and choose a photo and click Share icon. It will show "Share" activities(FB, Twitter, etc) and "Action" activities(Copy, Slideshow, etc). Goto end of "Action" activities and click "More" button

enter image description here

3) In the "Activities" page, you have to enable your "Action" extension

enter image description here

Paramasivan Samuttiram
  • 3,728
  • 1
  • 24
  • 28
  • By running the extension directly from the simulator as you suggested, I can indeed run it, but it still isn't debugging, because I still don't get 'Photos' in the host app options. – Neil Coxhead Aug 21 '14 at 12:40
  • Do you mean that your host app does not have photos? – Paramasivan Samuttiram Aug 21 '14 at 13:24
  • I wasn't talking about my host app - i.e. the main app my extension is embedded in, I mean the host app that should be able to run my extension. – Neil Coxhead Aug 27 '14 at 14:06
  • If what you meant is whether my photos app on the simulator doesn't have any photos in it, it does, and I added one of my own, switched my extension on in the '...more' menu, but when debugging I still don't get offered to run it via the photos app. – Neil Coxhead Aug 27 '14 at 14:09
  • i did the same but it doesn't show in Action Activities(Device) please refer my question http://stackoverflow.com/questions/35268508/i-need-to-show-my-ios-app-in-uiactivityviewcontroller-of-all-applications-as-act – Sanju Feb 09 '16 at 06:48