前幾天升級OS X EI Capitan 10.11.1, 以及Xcode7.1,正好趕上公司新產品上線,要做iOS9的適配,遇到各種坑,各種查資料,隨之記錄總結一下遇到的坑.
先說下要適配iOS9要做的事:
1.更改http為https
兩種方案:
一.公司后台服務器更改;
二.作為開發者,可在Xcode暫時退回到http協議. 開發者更改方法如下:
1.在Info.plist中添加App Transport Security Settings (或NSAppTransportSecurity), 類型Dictionary。
2.在App Transport Security Settings下添加Allow Arbitrary Loads (或NSAllowsArbitraryLoads), 類型Boolean,值設為YES.
2.對於使用ShareSDK第三方登錄或分享,對iOS9的適配
可參考官方文檔詳細介紹:http://wiki.mob.com/ios9-對sharesdk的影響(適配ios-9必讀)
包括:https協議支持,關閉bitcode支持,添加Scheme白名單.
您的 App 正在使用廣告標識符 (IDFA)。您必須先提供關於 IDFA 的使用信息或將其從 App 中移除,然后再上傳您的二進制文件。
ShareSDK里面自帶sina的原生SDK, 要刪掉SDK extend里面 sina的所有文件, 再打包上傳就可以. (刪掉后新浪微博還可以分享)
可用終端命令:
grep -r advertisingIdentifier .
檢測這個.a文件
3.Xcode7報錯:Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:]
從iOS9開始,Xcode7需要所有UIWindow在makeKeyAndVisible之前必須有一個rootViewController,否則報以上錯誤。
解決方案:
UIViewController *emptyView = [[UIViewController alloc] init];
self.window.rootViewController = emptyView;
[self.window makeKeyAndVisible];
4.Xcode7打開舊項目FrameWork文件夾下的.dylib庫缺失,添加方法
項目Target中Link Binary With Libraries 點擊下方 “+”添加, 顯示搜索頁面,在此搜.dylib搜不出來(只能搜到同名的.tbd), 需點擊 Add Other,出現文件目錄頁面 (正常情況通過Finder同樣找不到.dylib文件,因該文件是隱藏文件。需按快捷鍵 CMD+Shift+G,輸入/usr/lib后進入隱藏界面,然后添加需要的.dylib即可。
5.Xcode7 真機測試,真機出現"unavailable"字樣,Could not find developer disk image.
stackoverflower答案: 點擊查看
解決方案:
先關閉Xcode.再從Xcode 6.4中,拷貝8.4 (12H141)文件夾到Xcode 7的對應目錄下.
Xcode 6.4路徑為:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
Xcode 7路徑為:
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
重新打開Xcode 7,打開項目,需要等一會,等到菊花不轉了,才能運行。
6.App上傳Appstore錯誤
- Bundle version
- Bundle identifier
- Bundle versions string, short
7.App上傳Appstore錯誤
“invalid package Applications built with SDK 9.0 or later must be packaged as proper IPA files.”
#!/bin/bash
APPNAME="appName"
ZIPNAME="zipName"
IPANAME="ipaName"
mkdir ./ipa/Payload
cp -r ./${APPNAME}.app ./ipa/Payload
cd ipa
zip -r ${ZIPNAME} *
mv ${ZIPNAME}.zip ${IPANAME}.ipa
8.App上傳Appstore錯誤
ERROR ITMS-90535 Unexpected CFBundleExecutable Key.
解決方案:
2,在Stackoverflow上也有相關的解決辦法,就是把無用的CFBundle刪除掉。 點擊查看
在工程里面搜索info.plist,可以先搜索info,找到第三方的info.plist文件,刪除里面的Executable file對應的一整行,包括值。
-> 0x2be590cc <+0>: bx lr
在網上看到的答案:
選 Project,然后進 BuildPhases,然后進 LinkBinaryWithLibraries. 找到 GLKit.Framework ,把它的 status 更改為 optional 就 ok.(如果沒有GLKit.Framework, 添加一個再設置)
因bug無法重現,無法驗證以上方法是否可行. (有同行伙伴親測此方法可行)
<2>Xcode7.1真機測試啟動崩潰,模擬器正常,添加Enable Address Sanitizer調試,崩潰在啟動頁.
libclang_rt.asan_ios_dynamic.dylib`__asan::AsanDie:
-> 0x5e8240 <+0>: push {r4, r5, r7, lr} //代碼崩潰在此行
0x5e8242 <+2>: add r7, sp, #0x8
0x5e8244 <+4>: dmb ish
打印信息如下:
AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
==891==Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING.
==891==ASan shadow was supposed to be located in the [0x3ffff000-0x5fffffff] range.
==891==Process memory map follows:
------后面部分省略
目前的解決辦法:
打開
把Enable Address Sanitizer 取消
