錯誤集

錯誤1:

'release' is unavailable: not available in automatic reference counting mode..

解決辦法:

You need to turn off Automatic Reference Counting. You do this by clicking on your project in the navigator (the top item in the finder-like thing on the left), then click on your target, select "Build Settings" and turn off the option "Objective-C Automatic Reference Counting" (you can use the search field on the upper right to search it).




錯誤2:

@synthesize of ‘weak’ property is only allowed in ARC or GC mode,

解決方法:

比較好的解決辦法就是項目配置文件->Build Phrases->Complie Sources,找到出現問題的資源庫文件(比如weak修飾符所在的文件),雙擊Complie Files中的該文件,在空白行中寫入-fobjc-arc,這樣就可以有效防止該衝突。反過來有的時候,在arc代碼中引入手動管理內存的代碼,我們在Complie Files中爲新增的資源文件增加-fno-objc-arc,這樣就避免了手動管理內存的代碼在arc代碼中的衝突。




錯誤3:iOS - Xcode升級後的問題:Undefined symbols for architecture x86_64

1.把1.選中Targets—>Build Settings—>Architectures。

把build active architectures only 改爲 NO。
2. 把最下面的Valid Architectures中的arm64參數刪掉就可以了
或者:雙擊Architectures,選擇other,刪除$(ARCH_STANDARD),然後增加armv7和armv7s(寫上:$(ARCHS_STANDARD_32_BIT))。
3.clean 再build。



錯誤4:

Undefined symbols for architecture i386:

  "_OBJC_CLASS_$_QREncoder", referenced from:

      objc-class-ref in MenuItemDetailViewController.o

ld: symbol(s) not found for architecture i386

clang: error: linker command failed with exit code 1 (use -v to see invocation)

這個就要去MenuItemDetailViewController類中把_QREncoder引用去掉,或者添加_QREncoder庫


錯誤5:未添加.a庫文件

 第一種方式:直接將對應平臺的.a文件拖拽至Xcode工程左側的Groups&Files中,缺點是每次在真機和模擬器編譯時都需要重新添加.a文件;

第二種方式:使用lipo命令將設備和模擬器的.a合併成一個通用的.a文件,將合併後的通用.a文件拖拽至工程中即可,具體命令如下:
lipo -create Release-iphoneos/libbaidumapapi.a Release-iphonesimulator/libbaidumapapi.a -output libbaidumapapi.a

第三種方式:

1.將API的libs文件夾拷貝到您的Application工程跟目錄下

2.在Xcode的Project -> Edit Active Target -> Build -> Linking -> Other Linker Flags中添加-ObjC

3.設置靜態庫的鏈接路徑,在Xcode的Project -> Edit Active Target -> Build -> Search Path -> Library Search Paths中添加您的靜態庫目錄,比如"$(SRCROOT)/../libs/Release$(EFFECTIVE_PLATFORM_NAME)",$(SRCROOT)宏代表您的工程文件目錄,$(EFFECTIVE_PLATFORM_NAME)宏代表當前配置是OS還是simulator

注:靜態庫中採用ObjectC++實現,因此需要您保證您工程中至少有一個.mm後綴的源文件(您可以將任意一個.m後綴的文件改名爲.mm),或者在工程屬性中指定編譯方式,即將Xcode的Project -> Edit Active Target -> Build -> GCC4.2 - Language -> Compile Sources As設置爲"Objective-C++"

4:在Link Binary With Libraries中點擊+號,add other,把庫文件添加進去即可。


錯誤6:

“No matching provisioning profiles found for application”

There's a couple possibilities for your issue, but the main causes is what I got from experience as well as other SO answers.

  1. Your certificate or profile is outdated, in which case you have to go and regenerate your profiles again. I had this problem before, but Apple has described (partially) this issue.
  2. You haven't set your profile in the Build Settings/Code Signing area, along with the appropriate certificates. Verify your Team in General/Identity and ensure that your profile is properly set.

    From Xcode 5: Code signing entitlement errors (The image is a bit outdated, but its the same as Xcode 6): Build Settings Code Signing section

  3. You are using a beta version of Xcode.
  4. @jaytrixz states: "I just removed Entitlements.plist in Code Signing Entitlements under Build Settings" which could possibly work. Be sure that your provisioning profiles are configured as well.

錯誤7

xCode中去除“Implicit declaration of function 'sysctl' is invalid in C99” 警告


Implicit declaration of function 'CC_MD5' is invalid in C99”
隱式聲明瞭函數,可能是是沒有引入函數定義的頭文件。
比如我的警告是“Implicit declaration of function 'CC_MD5' is invalid in C99”,在文件開頭加入

#import <CommonCrypto/CommonDigest.h>即可。

發佈了58 篇原創文章 · 獲贊 1 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章