iOS8新特性测试入门-----Share Extension

本人在团队分享时用evernote做的一个演示文稿,所以阅读起来不是很方便,后续会更多以文章类型来沉淀;


  • share extension是什么?
  1. 分享一个网页、或者内容(包括图片、视频、文字、url等)给其他人



  • 创建一个share extension
  1. 苹果建议通过模板来创建extension,因为会自动帮你生成很多配置项,包括分享的viewController;
  2. 操作步骤
  • 理解share extension
  1. 方便用户发布内容
  2. 如果可以,让用户内容预览、编辑、注释以及修改内容
  3. 在用户发送之间对内容进行校验


Table 3  Keys for the  NSExtensionActivationRule dictionary

Key

Description

NSExtensionActivationSupportsAttachmentsWithMaxCount

Include this key to indicate to the system and to other apps that your app supports a maximum number of attachments.

NSExtensionActivationSupportsAttachmentsWithMinCount

Include this key to indicate to the system and to other apps that your app supports a minimum number of attachments.

NSExtensionActivationSupportsFileWithMaxCount

Include this key to indicate to the system and to other apps that your app supports files in general.

NSExtensionActivationSupportsImageWithMaxCount

Include this key to indicate to the system and to other apps that your app supports image files.

NSExtensionActivationSupportsMovieWithMaxCount

Include this key to indicate to the system and to other apps that your app supports movie files.

NSExtensionActivationSupportsText

Include this key to indicate to the system and to other apps that your app supports text.

NSExtensionActivationSupportsWebURLWithMaxCount

Include this key to indicate to the system and to other apps that your app supports web URLs.

NSExtensionActivationSupportsWebPageWithMaxCount

Include this key to indicate to the system and to other apps that your app supports web pages. 



  • 设置分享的数据类型
  1. value设置项为允许分享的最大数量,例如图片设置为1,则不能分享多图;
  2. 如果不允许分享改数据类型,可以设置为0,或者取消键值;


  • Debug extension
  1. debug时需要选中share extension的target进行编译;
  2. 编译完会弹出手机的程序供你选择,例如相册、safari、其他App

  • 数据共享
  1. 将container app和target设置为同个 app groups,允许访问共享数据;
  2. 使用NSUserDefaults存储数据;


  • 执行发表操作
  1. 调用 didSelectPost函数
  2. 使用NSURLSession进行上传
  3. 不能持续执行后台任务
  4. post操作后不能再给出提示框
  5. 不能使用scheme呼起container app,需要使用NSExtensionContext来做交互
NSExtensionContext Class Reference

  • 测试关注点
  1. info.plist配置是否正确
    • 只允许分享一张照片
  2. 登录态的校验
    • 上传前
  3. post数据校验----
    • 字符串长度
    • emoji表情
  4. 自定义分享页面的测试
    • 地理位置
    • 分类选择
    • 数据请求与处理
  5. 自定义分享页面的跳转
    • 进入分类选择
    • @好友选择
  6. 点击post后的测试
    • 不能持续时间太长,多长?
  7. 唤起container app的验证
    • 跳转对应页面
    • 无登陆时,全新安装时的处理逻辑

相关的图片展示:



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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值