Writing an iOS 8 share extension without a storyboard

前端 未结 4 1260
慢半拍i
慢半拍i 2020-12-25 12:36

Does anyone know of a good way to write an iOS 8 share extension without the MainInterface.storyboard that comes with the template?

When I delete the fi

4条回答
  •  情歌与酒
    2020-12-25 13:16

    Instead of the @objc hack, the proper way to do it in Swift is to include the module name in NSExtensionPrincipalClass, i.e.,

    NSExtensionPrincipalClass
    $(PRODUCT_MODULE_NAME).ActionViewController
    

    (Documenting the error otherwise:

    *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: ...)'
    

    Hopefully will help someone who run into this error in the future.)

提交回复
热议问题