Application Extension 扩展 分享
第一添加扩展支持 info.plist
<key>UIFileSharingEnabled</key>
<string>YES</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>public.movie</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>public.3gpp2</string>
<string>public.mpeg</string>
<string>public.avi</string>
<string>com.apple.quicktime-movie</string>
<string>public.3gpp</string>
<string>public.video</string>
<string>public.movie</string>
<string>public.mpeg-4</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>public.plain-text</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>public.plain-text</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>image</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>public.png</string>
<string>com.apple.macpaint-image</string>
<string>com.apple.pict</string>
<string>public.camera-raw-image</string>
<string>public.jpeg-2000</string>
<string>public.jpeg</string>
<string>public.image</string>
<string>com.kodak.flashpix.image</string>
<string>com.ilm.openexr-image</string>
<string>com.sgi.sgi-image</string>
<string>com.adobe.photoshop-image</string>
<string>com.adobe.illustrator.ai-image</string>
<string>com.compuserve.gif</string>
<string>com.microsoft.bmp</string>
<string>com.microsoft.ico</string>
<string>com.truevision.tga-image</string>
</array>
</dict>
</array>
添加扩展 Share Extension (怎么添加分享扩展到项目可以百度)
自定义UI 核心代码
override func loadView() {
custom.backgroundColor = .red
self.view = custom
}
主App 和 扩展通讯数据使用通知 项目添加group
let userDefaults = UserDefaults.init(suiteName: "group.rrr.rrr")
剩下看demo 吧
网友评论