X code 6错误 - "缺少所需i386硬件架构"当构建用于iPhone模拟器 [英] Xcode 6 Error - "Missing Required Architecture i386" When Building for iOS Simulator

查看:297
本文介绍了X code 6错误 - "缺少所需i386硬件架构"当构建用于iPhone模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个定制的Objective-C框架。我想将其导入到任何iOS的项目,并同时在iPhone模拟器和实际设备使用其提供的功能。要导入的框架,我用的构建阶段将其链接>链接二进制与图书馆在应用程序的目标设定。我就能够将其导入到我的班,这种说法之一:

I have created a custom Objective-C framework. I would like to import it into any given iOS project and use its provided functionality on both the iOS Simulator and an actual device. To import the framework, I link it using the Build Phases > Link Binary With Libraries setting in the app's target. I'm then able to import it into one of my classes with this statement:

#import <CustomFramework/CustomFramework.h>

我可以实例化我的框架的课就好了,但是当我尝试在设备上运行我的项目,我得到了以下错误消息:

I can instantiate my framework's classes just fine, but when I try to run my project on a device, I get the following error message:

dyld: Library not loaded: @rpath/CustomFramework.framework/CustomFramework
Referenced from: /var/mobile/Applications/A61E882D-481A-4C0B-B4FD-69F5D24968BF/TestApp.app/TestApp
Reason: image not found

如果我试图在模拟器上运行它,我得到一个不同的错误信息:

And if I try to run it on the simulator, I get a different error message:

ld: warning: ignoring file /Users/user/Desktop/CustomFramework.framework/CustomFramework, missing required architecture i386 in file /Users/user/Desktop/CustomFramework.framework/CustomFramework (2 slices)
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_CustomFramework", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

当我从框架实例化类出现这种情况。如果我输入了框架,但实际上并不使用它,我的应用程序成功生成。它只是每当我实例化一个类从出于某种原因,该框架的错误。

This occurs when I instantiate a class from the framework. If I import the framework but don't actually use it, my app builds successfully. It just errors whenever I instantiate a class from the framework for some reason.

要获得应用程序建立一个设备上,我也跟着<一个href=\"http://stackoverflow.com/questions/20092886/image-not-found-error-while-using-custom-framework/20095185#20095185\">this SO回答。而不是链接框架,我增加目标的构建阶段设置一个新的复制文件阶段,目标设置为框架,并增加我的框架。

To get the app to build on a device, I followed this SO answer. Instead of linking the framework, I added a new Copy Files phase in the target's Build Phases setting, set the Destination to Framework, and added my framework.

这伟大工程;不过,我想测试我在iOS模拟器应用程序也是如此。当我尝试运行我在模拟器上的应用程序,我仍然得到缺少必需i386硬件架构的错误。我试着在几乎每一个相关的SO话题我能找到所提出的解决方案,并没有帮我解决这个问题。

That works great; however, I'd like to test my app on the iOS Simulator as well. When I try to run my app on the simulator, I still get the "missing required architecture i386" error. I've tried the solutions proposed at just about every related SO topic I could find, and nothing has helped me resolve this issue.

请注意,我试图用我自定义的框架,新的X code项目,所以没有任何的应用程序/构建设置已经更改其缺省值。

Please note that I am trying to use my custom framework in a new Xcode project, so none of the app/build settings have been changed from their defaults.

我怎样才能解决这个错误,这样我可以运行我在iOS模拟器和我的框架设备应用程序都包含在项目中?任何有识之士将大大AP preciated!

How can I fix this error so that I can run my app on both the iOS Simulator and a device with my framework included in the project? Any insight would be greatly appreciated!

推荐答案

的问题是,该框架编译时不为iPhone模拟器的架构,这是i386的。 X $ C $仅C编译目标体系结构的框架,所以如果我建为iPhone模拟器的框架,它不会在设备上工作,如果我建一个设备的框架,它不会对工作iOS的模拟器。

The issue was that the framework was not compiled for the iOS Simulator's architecture, which is i386. Xcode only compiles a framework for the target architecture, so if I built the framework for the iOS Simulator, it wouldn't work on a device, and if I built the framework for a device, it wouldn't work on the iOS Simulator.

我创建了框架从无到有从本教程的帮助: HTTP: //www.raywenderlich.com/65964/create-a-framework-for-ios

I created my framework from scratch with help from this tutorial: http://www.raywenderlich.com/65964/create-a-framework-for-ios

多架构构建脚本是什么让我的框架,在iOS模拟器和设备都运行。

The multi-architecture build script is what allowed my framework to run on both the iOS Simulator and a device.

这篇关于X code 6错误 - &QUOT;缺少所需i386硬件架构&QUOT;当构建用于iPhone模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆