App Watch 应用开发过程

新建完成以后多了 WatchKit Extension 和WatchKit App
–两个功能简介
Extension用来实现Watch App的数据逻辑处理并且和主App的交互
Watch App用来绘制界面,并且只能用storyboard,不支持代码绘制界面
–bundle id(假设主工程id为http://xxx.xxx.xxx)
Extension中Info.plist的bundle id为xxx.xxx.xxx.watchkitextension
Watch App中Info.plist的bundle id为xxx.xxx.xxx.watchkitapp

2、开发
1)为了减少WatchKit过多的逻辑处理和代码的复用性,我们在
在WatchKit Extension中把要处理的网络请求、数据逻辑处理等
通过
[WKInterfaceController openParentApplication:weatherInfo reply:^(NSDictionary *replyInfo, NSError *error) {}
传递给主App,当主App请求到数据或者处理完逻辑以后通过方法

  • (void)application:(UIApplication *)application handleWatchKitExtensionRequest: (NSDictionary *)userInfo reply:(void(^)(NSDictionary *replyInfo))reply
    {
    通过reply方法把结果返回给Watch Extension
    }
    2)用InterfaceController绘制的界面不能叠加,不支持addSubview等操作。
    3)当在controller上面present一个controller以后就不能再做push controller的操作了。
    4)InterfaceController上面的元素设计好以后就不能调整改变,只能支持设置Hidden和alpha属性

3、调试
1)目前Xcode6.2开发经常模拟器起来的时候一直黑屏(在调试Glance页面的时候),解决方 法:
–退出重启XCode
–在Glance InterfaceController中把 Hides When Loading这个选项打钩
2)模拟器Glance点击进入到Watch App的时候不会促发Glance中的didDeactive
目前要想知道离开的状态,那么只能notification

4、提交审核
第一次提交审核Watch App审核,苹果后台中要求
–Watch App和Extension的版本号要跟主App的版本号一致
–要添加Watch App iCon和截图


not about
https://www.jianshu.com/p/74cba1e350c7

猜你喜欢

转载自blog.csdn.net/TENCENTSYS/article/details/89278223