iOS App Extension with xib instead of storyboard

蹲街弑〆低调 提交于 2019-12-03 00:28:15

all you need to do is add "NSExtensionPrincipalClass" and the classname which you want.

As I recently discovered the hard way - notice that the 'NSExtensionPrincipalClass' must be directly under the 'NSExtension' key. e.g class ShareViewController:

<key>NSExtension</key>
<dict>
    <key>NSExtensionPrincipalClass</key>
    <string>ShareViewController</string>
    ...
</dict>

By default, the Today template supplies the following Info.plist keys and values (shown here for an OS X target):

<key>NSExtension</key>
<dict>
    <key>NSExtensionPointIdentifier</key>
    <string>com.apple.widget-extension</string>
    <key>NSExtensionPrincipalClass</key>
    <string>TodayViewController</string>
</dict>

If you use a custom view controller subclass, use the custom class name to replace the TodayViewController value for the NSExtensionPrincipalClass key.

iOS. If you don’t want to use the storyboard file provided by the template, remove the NSExtensionMainStoryboard key and add the NSExtensionPrincipalClass key, using the name of your view controller for the value.

Most of the work you do to create a Today widget involves designing the UI and implementing a view controller subclass that performs your custom functionality.

BY APPLE GUIDELINES:-->click to view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!