1. 程式人生 > >手動匯入AFNetwork報錯

手動匯入AFNetwork報錯

iOS 開發中匯入AFNetworking網路框架時時報錯。

出現如下錯誤提示

1. Use of undeclared identifier 'kSecFormatUnknown'
2. Use of undeclared identifier 'kSecItemPemArmour'
3. Implicit declaration of function 'SecItemExport' is invalid in C99

如圖所示:


解決方法:

AFSecurityPolicy.m檔案 把下面兩個標頭檔案換一下可解決問題,但是不知會否引起其他問題,我目前在用沒問題
將:#if !TARGET_OS_IOS && !TARGET_OS_WATCH
替換成:#if !defined(__IPHONE_OS_VERSION_MIN_REQUIRED)

將:#if TARGET_OS_IOS || TARGET_OS_WATCH
替換成:#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED)