I decided to start experimenting with the new Photos editing extension stuff that's now in Xcode 7 beta 2, but have been having trouble getting even a basic extension to load properly in Photos. I started out by creating a new project, then adding a new target using the "Photo Editing Extension" template. I read the part in the release notes about the template still having iOS class names (e.g. UIViewController), so I replaced that stuff and was able to get the extension to compile just fine. The extension does get listed in Photos (and the Extensions pane in System Preferences), but I run into trouble when trying to actually load the extension from within Photos.
Initially, I would get an exception thrown somewhere in the exension internals, with a stack trace looking like this:
Application Specific Information:
Crashing on exception: *** setObjectForKey: object cannot be nil (key: <__NSConcreteUUID 0x7fc7b20210d0> 6B0D50C3-FB4F-4AB5-B90D-022ADE140FAF)
Application Specific Backtrace 1:
0 CoreFoundation 0x00007fff8e956a55 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00007fff9689313a objc_exception_throw + 48
2 CoreFoundation 0x00007fff8e834cc7 -[__NSDictionaryM setObject:forKey:] + 2071
3 libextension.dylib 0x00007fff94d460b2 -[_NSExtensionContextVendor _setPrincipalObject:forUUID:] + 123
4 libextension.dylib 0x00007fff94d457d5 __105-[_NSExtensionContextVendor _beginRequestWithExtensionItems:listenerEndpoint:withContextUUID:completion:]_block_invoke + 861
5 libdispatch.dylib 0x00007fff8e0bd814 _dispatch_call_block_and_release + 12
6 libdispatch.dylib 0x00007fff8e0b9765 _dispatch_client_callout + 8
7 libdispatch.dylib 0x00007fff8e0cad26 _dispatch_main_queue_callback_4CF + 1677
8 CoreFoundation 0x00007fff8e89f079 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
9 CoreFoundation 0x00007fff8e85af94 __CFRunLoopRun + 1908
10 CoreFoundation 0x00007fff8e85a5b8 CFRunLoopRunSpecific + 296
11 HIToolbox 0x00007fff94684ce9 RunCurrentEventLoopInMode + 235
12 HIToolbox 0x00007fff94684a7f ReceiveNextEventCommon + 432
13 HIToolbox 0x00007fff946848bf _BlockUntilNextEventMatchingListInModeWithFilter + 71
14 AppKit 0x00007fff97a2c732 _DPSNextEvent + 927
15 AppKit 0x00007fff97df9f74 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 324
16 ViewBridge 0x00007fff8f22f531 -[NSViewServiceApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 73
17 AppKit 0x00007fff97a226c2 -[NSApplication run] + 682
18 AppKit 0x00007fff979a4c4f NSApplicationMain + 1176
19 libxpc.dylib 0x00007fff8dc951d0 _xpc_objc_main + 793
20 libxpc.dylib 0x00007fff8dc9691f _xpc_main_listener_event + 0
21 Foundation 0x00007fff95c60010 +[NSXPCListener serviceListener] + 0
22 PlugInKit 0x00007fff98a56e96 -[PKService run] + 493
23 PlugInKit 0x00007fff98a56b77 +[PKService main] + 55
24 PlugInKit 0x00007fff98a56ed8 +[PKService _defaultRun:arguments:] + 17
25 libextension.dylib 0x00007fff94d4faaa NSExtensionMain + 51
26 libdyld.dylib 0x00007fff96c505ad start + 1
27 ??? 0x0000000000000001 0x0 + 1
I did some poking around in the Info.plist for the extension, and noticed that it had an NSExtensionPrincipalClass key specified, with the NSViewController subclass that was created by the template. The app extension docs (for iOS, since they haven't been updated with Mac info yet) state that you should use the NSExtensionMainStoryboard key instead. So, I created a storyboard containing one scene that uses the same view controller subclass, with that controller set as the initial view controller. That seemed to make a little progress, as I no longer got the error above, but instead get an exception that looks like this:
Application Specific Information:
Crashing on exception: addChildViewController: called with a nil childViewController
Application Specific Backtrace 1:
0 CoreFoundation 0x00007fff8e956a55 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00007fff9689313a objc_exception_throw + 48
2 CoreFoundation 0x00007fff8e95682a +[NSException raise:format:arguments:] + 106
3 Foundation 0x00007fff95c7b1bc -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 AppKit 0x00007fff97b712ef -[NSViewController insertChildViewController:atIndex:] + 157
5 PhotosUI 0x00000001028923e9 -[PHEditingViewService setupWithController:] + 84
6 PhotosUI 0x0000000102892368 -[PHEditingViewService connectToContextWithSessionID:withCompletionHandler:] + 182
7 CoreFoundation 0x00007fff8e82550c __invoking___ + 140
8 CoreFoundation 0x00007fff8e82535e -[NSInvocation invoke] + 286
9 CoreFoundation 0x00007fff8e8c3d36 -[NSInvocation invokeWithTarget:] + 54
10 ViewBridge 0x00007fff8f27d44b __68-[NSVB_ViewServiceImplicitAnimationDecodingProxy forwardInvocation:]_block_invoke + 47
11 ViewBridge 0x00007fff8f287d0d __runAnimationGroup_block_invoke + 21
12 AppKit 0x00007fff979d5e97 +[NSAnimationContext runAnimationGroup:completionHandler:] + 82
13 ViewBridge 0x00007fff8f287ce9 runAnimationGroup + 317
14 ViewBridge 0x00007fff8f27cf0b +[NSVB_View _animateWithAttributes:animations:completion:] + 531
15 ViewBridge 0x00007fff8f27d3bc -[NSVB_ViewServiceImplicitAnimationDecodingProxy forwardInvocation:] + 183
...and a lot more internal gunk
It seems like it's not able to instantiate the view controller, but at this point, I'm stumped as to exactly why that might be. Anyone had any better luck with this?