学习iOS App Extension过程一

这两天一在看iOS的App Extension功能,想把它加到我们的产品中去。

网上搜Demo挺简单,但做到细节的时候单靠Demo是不行的,还需要仔细看看Apple的各种文档。

其中主要是研究了Share Extension 和 Action Extension。

过程中遇到了不少的坑,如下:

一、Share Extension对javascript方法finalize的支持一直没有试出来,Action Extension是支持的,官方也没说哪些支持哪些不支持。

二、plist配置失败(如某个关键值拼写错误)会导至编译通过,但在Host App中显示出来。

三、关于Share Extension自定义UI的问题,去掉默认的弹出发送框,只需要新建storyboard并在plist中声明,ViewController不要继承SLComposeServiceViewController,Extension相关的方法如 NSExtensionContext 默认都是UIViewcontroller的方法,还要注意把Storyboard自定Entry Point,否则会崩溃。而不是像官网上说的,如下:

NOTE

To provide a custom compose view instead of the standard one, deselect “Use standard social compose interface” in the Xcode target-adding pane. When this checkbox is deselected, the defaultSharingViewController class is based on NSViewController or UIViewController, depending on the platform you chose.

新版的xcode(7.2)已经找不到这种操作了。


参考文档如下:

https://github.com/atomicbird/iOS-Extension-Demo

http://www.cocoachina.com/ios/20141023/10027.html

http://blog.csdn.net/phunxm/article/details/42715145

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值