objective-c - 未找到体系结构 i386 的符号

尝试使用 Xcode 进行编译时,出现以下错误:

  **Ld /Users/doronkatz/Library/Developer/Xcode/DerivedData/iKosher-bphnihrngmqtkqfgievrrumzmyce/Build/Products/Debug-iphonesimulator/iKosher.app/iKosher normal i386
    cd /Users/doronkatz/Sites/xCode/iKosher
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    setenv PATH "/Xcode4/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Xcode4/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Xcode4/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk -L/Users/doronkatz/Library/Developer/Xcode/DerivedData/iKosher-bphnihrngmqtkqfgievrrumzmyce/Build/Products/Debug-iphonesimulator -L/Users/doronkatz/Sites/xCode/iKosher -F/Users/doronkatz/Library/Developer/Xcode/DerivedData/iKosher-bphnihrngmqtkqfgievrrumzmyce/Build/Products/Debug-iphonesimulator -filelist /Users/doronkatz/Library/Developer/Xcode/DerivedData/iKosher-bphnihrngmqtkqfgievrrumzmyce/Build/Intermediates/iKosher.build/Debug-iphonesimulator/iKosher.build/Objects-normal/i386/iKosher.LinkFileList -mmacosx-version-min=10.6 -all_load -ObjC -Xlinker -objc_abi_version -Xlinker 2 -lz -framework Security -framework CFNetwork -framework CoreData -framework Foundation -framework UIKit -framework CoreGraphics -framework QuartzCore -o /Users/doronkatz/Library/Developer/Xcode/DerivedData/iKosher-bphnihrngmqtkqfgievrrumzmyce/Build/Products/Debug-iphonesimulator/iKosher.app/iKosher

Undefined symbols for architecture i386:
  "_UTTypeCreatePreferredIdentifierForTag", referenced from:
      +[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
  "_UTTypeCopyPreferredTagWithClass", referenced from:
      +[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
  "_kUTTagClassMIMEType", referenced from:
      +[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
  "_kUTTagClassFilenameExtension", referenced from:
      +[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
  "_SCNetworkReachabilitySetCallback", referenced from:
      -[Reachability startNotifier] in Reachability.o
  "_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
      -[Reachability startNotifier] in Reachability.o
  "_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
      -[Reachability stopNotifier] in Reachability.o
  "_SCNetworkReachabilityCreateWithName", referenced from:
      +[Reachability reachabilityWithHostName:] in Reachability.o
  "_SCNetworkReachabilityCreateWithAddress", referenced from:
      +[Reachability reachabilityWithAddress:] in Reachability.o
  "_SCNetworkReachabilityGetFlags", referenced from:
      -[Reachability currentReachabilityStatus] in Reachability.o
      -[Reachability isReachable] in Reachability.o
      -[Reachability isConnectionRequired] in Reachability.o
      -[Reachability isConnectionOnDemand] in Reachability.o
      -[Reachability isInterventionRequired] in Reachability.o
      -[Reachability isReachableViaWWAN] in Reachability.o
      -[Reachability isReachableViaWiFi] in Reachability.o
      ...
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status**

不知道是什么意思。

最佳答案

如果你突然出现这种情况,这通常意味着项目缺少一些它需要的框架。库和相关项目可能需要框架,因此如果您最近添加了框架,则可能会导致此错误。

要添加框架,请在项目 View 中右键单击项目名称,选择Add,然后从列表中选择Existing frameworks...。然后找到您缺少的符号的框架。

至于如何找到所需的框架,我发现使用 google 是最简单的,尽管您也可以使用 Xcode 帮助搜索。搜索其中一个符号,尽力找出未损坏的名称(例如,SCNetworkReachabilityGetFlags),然后您在 developer.apple.com 上找到的第一个文档链接通常是正确的。您通常不必狩猎很远。在这种情况下,就是这个页面:

https://developer.apple.com/documentation/systemconfiguration/scnetworkreachability-g7d

然后在页面顶部,它告诉你使用哪个框架,在这种情况下是 SystemConfiguration。所以将它添加到项目中,然后再次编译。

然后继续这样做直到它起作用......

编辑:我从未使用过模拟器,但这是你在设备上所做的 - 我认为它是相同的......

https://stackoverflow.com/questions/4839981/

相关文章:

ios - 将 Project-Swift.h 导入到 Objective-C 类中...找不到文件

objective-c - #import 使用尖括号 < > 和引号 ""

objective-c - Objective-C 中的 protected 方法

ios - Xcode 9 中的 "This function declaration is not

objective-c - 从 iOS 上的 UIView 将图像保存到应用程序文档文件夹

objective-c - 如何在 Objective-C 中复制对象

ios - 如何使用 iOS 轻松调整/优化图像大小?

iphone - 以编程方式请求访问联系人

objective-c - 警告 : "format not a string literal an

ios - 在 iOS 应用程序中在哪里存储全局常量?