为什么我的项目不会在iPhone模拟器中运行?

Han*_*kke 5 iphone ios-simulator

出于某种原因,我的应用程序将在我的设备上安装并运行正常,但是当我尝试在iPhone模拟器上安装我的应用程序时,我收到以下警告:

ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/Frameworks/UIKit.framework/UIKit, missing required architecture i386 in file


ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/Frameworks/Foundation.framework/Foundation, missing required architecture i386 in file


ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics, missing required architecture i386 in file


ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/Frameworks/CFNetwork.framework/CFNetwork, missing required architecture i386 in file


ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox, missing required architecture i386 in file


ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices, missing required architecture i386 in file


ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration, missing required architecture i386 in file


ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/Frameworks/QuartzCore.framework/QuartzCore, missing required architecture i386 in file
Run Code Online (Sandbox Code Playgroud)

这会导致在这些框架不存在时发生的一系列错误.错误如:

  "_OBJC_CLASS_$_NSMutableCharacterSet", referenced from:      objc-class-ref-to-NSMutableCharacterSet in SBJsonWriter.o
Run Code Online (Sandbox Code Playgroud)

Tec*_*Zen 0

它正在尝试针对设备库进行构建以在模拟器上使用。路径应如下所示:

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/UIKit
Run Code Online (Sandbox Code Playgroud)

... 用iPhoneSimulator.platform代替iPhoneOS.platform. 检查您的构建设置,清理项目并清空 Xcode 缓存(Xcode>Empty Cache...)。