iOS 开发到上架的小 tips(keng)
Xcode7 新建 playground 报错 Unable to find execution service for selected run destination
关闭 Xcode
rm -rf ~/Library/Developer/CoreSimulator/Devices
killall -9 com.apple.CoreSimulator.CoreSimulatorService
userinterfacestate.xcuserstate 文件对 Git 操作的影响
这个一般是建立项目之后,Git 提交的时候手贱勾上了这个文件,然后几秒钟更新一次,Git 提交总是报错有东西未 commit,打开项目文件夹
git rm --cached /your/path/to/userinterfacestate.xcuserstate
git commit -m "Removed the stupid strange file that shouldn't be tracked"
git push
就行了
有用的小东西
- UIDevice.currentDevice().name 获取设备名字
- UIDevice.currentDevice().systemVersion 获得 iOS 版本
- UIDevice.currentDevice().batteryLevel 获得电池。。不明白这个
- NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleVersion") as String 获得 build 号
- NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleShortVersionString") as String 获得版本号
iTunesConnect 新建一个 app,编辑 app 信息,保存时浏览器假死
先把预览图传了,再修改别的内容,就不会死了。
Xcode5 项目迁移到 Xcode6 时,pch 文件报错
一般是不会报错的,除非像我一样,强迫症,习惯手动在项目下见好多文件夹,分好类,把 pch 文件放到某个文件夹,Build Setting 配置好路径,Xcode5 是一切正常的,不过这个项目用 Xcode6 打开就杯具了,非说项目根目录没有 pch。
怎么解决呢,没有办法。。只能在根目录建一个同名文件,哪怕没有内容,至少不报错了。
UITableView空行不想显示single line怎么办
很简单,加上一句
self.tableView.tableFooterView = [[UIView alloc] init];
用了 StoryBoard 之后,UILable 警告 Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
这个也好办,故事板中把 UILable 的 numberOfLines,改成 1,在代码中
self.xxLable.numberOfLines = 0;
完美解决警告
APNS发布到商店,推送不可用
主要有以下几种情况:
- 苹果服务器地址没改(去掉 sandbox 即可)
- 这个才是最坑的,发布前没有用过生产证书的话,一定更新下
iOS Provisioning Profiles
,重新发布
内购项目的排序问题
直接
[[IAPShare sharedHelper].iap.products objectAtIndex:0]
你会不知道他顺序
加上这么一句
for (SKProduct *pro in [IAPShare sharedHelper].iap.products) {
NSLog(@"%@-----%@-----%@-----%@-----%@",pro.localizedDescription,pro.localizedTitle,pro.price,pro.priceLocale,pro.productIdentifier);
}
挨个打印出来,再做判断就好了
2015-01-18 17:43:30.568 eduadmin[521:120874] 大约是一个汉堡的价格-----自由捐赠-----12-----<__NSCFLocale: 0x1740e8f00>-----eduadm_donate_12
2015-01-18 17:43:30.571 eduadmin[521:120874] 大约是中杯星巴克的价格-----自由捐赠-----25-----<__NSCFLocale: 0x1740e8f00>-----eduadm_donate_25
2015-01-18 17:43:30.571 eduadmin[521:120874] 大约是一瓶可口可乐的价格-----自由捐赠-----3-----<__NSCFLocale: 0x1740e8f00>-----eduadm_donate_3
2015-01-18 17:43:30.572 eduadmin[521:120874] 大约是一碗麻辣烫的价格-----自由捐赠-----6-----<__NSCFLocale: 0x1740e8f00>-----eduadm_donate_6