当我尝试在iphone上构建我的应用程序时,为什么会出现“文件不是必需的架构”?

时间:2009-09-25 21:12:52

标签: iphone

我的应用程序似乎在模拟器中运行良好,但是我第一次将手机连接到我的系统并为它构建它我有一个巨大的错误日志,其中包括:

使用配置Debug

构建项目SCCUI的SCCUI
CompileXIB HandleAlert.xib
cd /Users/gdbriggs/Desktop/SCCUI
setenv IBC_MINIMUM_COMPATIBILITY_VERSION 3.1
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr
/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/usr/bin/ibtool --errors --warnings --notices --output-format human-readable-text --compile
/Users/gdbriggs/Desktop/SCCUI/build/Debug-iphoneos/SCCUI.app/HandleAlert.nib /Users/gdbriggs/Desktop/SCCUI/HandleAlert.xib

/* com.apple.ibtool.document.warnings */
/Users/gdbriggs/Desktop/SCCUI/HandleAlert.xib:13: warning: UITextView does not support data detectors when the text view is editable.

Ld build/Debug-iphoneos/SCCUI.app/SCCUI normal armv6
cd /Users/gdbriggs/Desktop/SCCUI
setenv IPHONEOS_DEPLOYMENT_TARGET 3.1
setenv MACOSX_DEPLOYMENT_TARGET 10.5
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk -L/Users/gdbriggs/Desktop/SCCUI/build/Debug-iphoneos -F/Users/gdbriggs/Desktop/SCCUI/build/Debug-iphoneos -F/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks -filelist /Users/gdbriggs/Desktop/SCCUI/build/SCCUI.build/Debug-iphoneos/SCCUI.build/Objects-normal/armv6/SCCUI.LinkFileList -mmacosx-version-min=10.5 -dead_strip -miphoneos-version-min=3.1 -framework Foundation -framework UIKit -framework CoreGraphics -framework MessageUI -o /Users/gdbriggs/Desktop/SCCUI/build/Debug-iphoneos/SCCUI.app/SCCUI

ld: warning: in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/Foundation.framework/Foundation, file is not of required architecture
ld: warning: in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/UIKit.framework/UIKit, file is not of required architecture
ld: warning: in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics, file is not of required architecture
ld: warning: in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/MessageUI.framework/MessageUI, file is not of required architecture
Undefined symbols:
  "_OBJC_CLASS_$_UIDevice", referenced from:
      __objc_classrefs__DATA@0 in SCAuthenticationHandler.o
  "_OBJC_CLASS_$_NSString", referenced from:
      __objc_classrefs__DATA@0 in CCProxy.o
      __objc_classrefs__DATA@0 in AlertSummaryViewController.o
      __objc_classrefs__DATA@0 in HomeLevelController.o
      __objc_classrefs__DATA@0 in SCAuthenticationHandler.o
      __objc_classrefs__DATA@0 in SCRequestHandler.o
  "_UIApplicationMain", referenced from:
  _main in main.o
  "_objc_msgSend", referenced from:
      _main in main.o
      _main in main.o
      _main in main.o
      -[SCCUIAppDelegate applicationDidFinishLaunching:] in

它一直在继续。

在底部/靠近底部,它说:

ld: symbol(s) not found
collect2: ld returned 1 exit status

我做错了什么?

3 个答案:

答案 0 :(得分:8)

解决方案帮助了我:

右键点击目标 - >获取信息 - > “构建”标签 - >使用名称设置:框架搜索路径添加值“$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/ Frameworks”并将其移至路径列表顶部

答案 1 :(得分:3)

您是否指定了这些路径?看着它们,它们都指向:/Developer/Platforms/iPhoneSimulator.platform / ...这解释了为什么你收到file is not of required architecture错误;它期待设备库及其发现模拟器库。

答案 2 :(得分:1)

旧的iPhone项目可能将“框架搜索路径”设置为不存在的SDK,如:

*/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk/System/Library/Frameworks*

由于这是硬编码,因此只要XCode更新删除了SDK就会中断。 然后模拟器构建失败,找不到基本符号,如“_OBJC_CLASS _ $ _ NSString”

Target的“框架搜索路径”的灵活设置确实是: $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/ Frameworks

iOS部署目标”需要至少更新为 iOS 3.0

设置好后,我可以在模拟器中运行我的旧应用程序。