Nothing leaves you feeling like a stroke victim more than doing something
you know you've done before and having it fail all over the place.

I'm trying to create a simple application with a dummy photo extension
written in swift.  I have already written an actual application with a
photo extension and that works (as well as it can given the occasional
nondeterministic behavior we and others have been seeing).

To make this demo app, made a new single-view application in Xcode.

Then I add a photo extension target, making sure to select Swift as the
language.

Then I make sure to go tell the application target that "Embedded content
contains swift code" because otherwise the photo extension will fail at
runtime with the *wildly misleading* and unhelpful error message: "blah
blah blah swiftrelated.dylib blah:image not found" (not, in fact, referring
to the image the photo extension has been asked to load).

Then I delete the Main.storyboard because I don't like storyboards.

Then I edit the info.plist created for the extension to remove the
NSExtensionMainStoryboard key and replace it with an
NSExtensionPrincipalClass key.

Then I run the photo extension target in the Photos app.

Upon selecting a photo and attempting to edit it with my new extension, I
get this error:

Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '*** setObjectForKey: object cannot be nil (key: <__NSConcreteUUID
0x7ffdd3f12c60> 21074A67-F7EF-423D-A245-8805C0CC134F)'
*** First throw call stack:
(
0   CoreFoundation                      0x0000000109d843f5
__exceptionPreprocess + 165
1   libobjc.A.dylib                     0x000000010b8f1bb7
objc_exception_throw + 45
2   CoreFoundation                      0x0000000109c8af18
-[__NSDictionaryM setObject:forKey:] + 968
3   libextension.dylib                  0x000000010b8b217a
-[_NSExtensionContextVendor _setPrincipalObject:forUUID:] + 114
4   libextension.dylib                  0x000000010b8b1880
__105-[_NSExtensionContextVendor
_beginRequestWithExtensionItems:listenerEndpoint:withContextUUID:completion:]_block_invoke
+ 822
5   libdispatch.dylib                   0x000000010cdd0c06
_dispatch_call_block_and_release + 12
6   libdispatch.dylib                   0x000000010cdeaaf4
_dispatch_client_callout + 8
7   libdispatch.dylib                   0x000000010cdd62e9
_dispatch_main_queue_callback_4CF + 490
8   CoreFoundation                      0x0000000109cec569
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
9   CoreFoundation                      0x0000000109caf46b __CFRunLoopRun +
2043
10  CoreFoundation                      0x0000000109caea06
CFRunLoopRunSpecific + 470
11  GraphicsServices                    0x000000011008a9f0 GSEventRunModal
+ 161
12  UIKit                               0x000000010a60e550
UIApplicationMain + 1282
13  libxpc.dylib                        0x000000010d0e3b4b _xpc_objc_main +
416
14  libxpc.dylib                        0x000000010d0e5ee0 xpc_main + 185
15  Foundation                          0x000000010a3311d1
service_connection_handler + 0
16  PlugInKit                           0x000000010960fba2 -[PKService run]
+ 521
17  PlugInKit                           0x000000010960f867 +[PKService
main] + 55
18  PlugInKit                           0x000000010960fbc6 +[PKService
_defaultRun:arguments:] + 17
19  libextension.dylib                  0x000000010b8bfcdd NSExtensionMain
+ 51
20  libdyld.dylib                       0x000000010ce1b145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException


Well, the ONLY reference to this that I can find is that some framework
isn't being implicitly loaded and is dying here.
See http://www.atomicbird.com/blog/ios-app-extension-tips at the section
titled "Enabling modules might not work as expected"

I have literally been pulling my hair out for two hours because I can't get
my boilerplate to work and I was actually trying to make a useful demo
project, not just bash my head against the same wall (not to mention the
hour that I spent trying to get Xcode to NOT build swift successfully when
it had copy-pasted Objective-C in it that was clearly not correct [which
required me to restart my entire computer]).

What am I doing wrong that I need to do right?

--
Daniel Blakemore
Pixio Software
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to