xcode 8 widget 真机调试
来源:互联网 发布:五子棋最强软件 编辑:程序博客网 时间:2024/06/05 20:06
作者:Love@YR
链接:http://blog.csdn.net/jingqiu880905/article/details/52983303
请尊重原创,谢谢!
真机调试widget,牵扯到配置group。
首先我们的宿主app id为com.xxx.jeantest , Today widget插件的bundle id为com.xxx.jeantest.StockReminder(StockReminder是随意取的名字,你也可以取其他)
这里我们需要注意,widget的bundle id必须以宿主bundle id作为前缀。
然后它俩之间建立的group id为group.xxx.freeInHouse(你可以取任意名)
下面看开发者证书那里如何配置:
一、Identifiers-App Groups 里添加一个app group id为:group.xxx.freeInHouse
二、创建app id。创建的时候选择Explict App ID,App Services里面勾选上App Groups
主app:
widget:
三、配置provisioning profile(这里不再赘述certificate的生成步骤,添加device等)
此时因为选择了勾选了App Groups这个service的app id,所以可以看到enabled services那里有此项
至此已经完成在开发者网站上配置含有widget的证书。
下面看下xcode里面如何配置:
一、当然是主app和widget这俩target的bundle id要和上面俩对应。
二、当然是这俩target的code signing那边provisioning profile,certificate都选对。
主target:
widget target:
注意此处的entitlements!!!
三、配置app group
xcode 主target 配置app group:
xcode widget target 配置app group:
关于entitlements:
当在xcode里加入app group就会自动生成entitlements。如果删了可以创新创建。看下其里面的内容:
这两个target相当于两个二进制文件,不能互相访问资源目录,程序中我们如何查找它们的共享目录呢?
NSFileManager * fileManager = [NSFileManager defaultManager]; NSString * groupPath = nil; NSURL * groupURL = nil; if([fileManager respondsToSelector:@selector(containerURLForSecurityApplicationGroupIdentifier:)]) { groupURL = [fileManager containerURLForSecurityApplicationGroupIdentifier:@"group.xxx.freeInHouse";//即group id } if(groupURL) { groupPath = groupURL.path; groupPath = [groupPath stringByAppendingPathComponent:@"sharefilename"]; }
如果是userdefault就把
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
换成
NSUserDefaults *sharedDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.xxx.freeInHouse"];
四、编译主target xxx-iphone-free 发现一些错误
1)错误log:
No profile matching ‘PaidWatchkitappAdhoc’ found: Xcode couldn’t find a profile matching ‘PaidWatchkitappAdhoc’. Install the profile (by dragging and dropping it onto Xcode’s dock item) or select a different one in the General tab of the target editor.
Code signing is required for product type ‘WatchKit App’ in SDK ‘iOS 10.0’
其中PaidWatchkitappAdhoc 是WatchKit App的provisioning profile,经查,发现此处:
把xxx-free watchkit extension.appex去掉即可。因为此处我们只调试today widget
2)编译还有个错误:
解决方法:把iCloud 关掉:
看到一篇有点关联的好文章:
http://www.cnblogs.com/lrr0618/p/5388350.html
里面有讲APP group的。
最后再说下iOS10上关于widget的改动:
发现用原来的代码widget总是显示不全,就是个固定高度。后来才知道10上加了折叠展开功能。
- (void)widgetActiveDisplayModeDidChange:(NCWidgetDisplayMode)activeDisplayMode withMaximumSize:(CGSize)maxSize
在这个方法里实现模式的切换,就会出现折叠展开按钮,并进行相应的frame改变。
- xcode 8 widget 真机调试
- xcode 真机调试
- xcode 破解,真机调试
- XCode破解真机调试
- 关于xcode真机调试
- Xcode 5真机调试
- Xcode 真机调试教程
- Xcode 真机调试教程
- xcode真机调试错误
- Xcode真机调试问题
- XCODE 添加调试真机
- Xcode 免费真机调试
- Swift: Xcode 真机调试
- xcode真机调试配置
- xcode无线真机调试
- Xcode 8 真机调试 iOS 11 beta
- iOS真机调试 for Xcode 5
- Xcode 4.3.2真机调试
- Spring Boot Junit单元测试
- 完全理解Python迭代对象、迭代器、生成器
- CF 70E Information Reform
- Java中关于字符串对象一些易错的点
- RunTime交换方法的实现
- xcode 8 widget 真机调试
- array_key_exists() 与 isset() 的区别
- JSP九大内置对象的作用和用法总结
- jar包、模板模式
- Android开发方法数超过64k(65k)解决办法
- 已启动程序,再启动通知原程序显示
- iOS高级编程之多线程的使用场景深入探索
- 黑苹果安装技巧!!!
- FlycoTabLayout使用