<small id='zl0tf'></small><noframes id='zl0tf'>

    1. <i id='zl0tf'><tr id='zl0tf'><dt id='zl0tf'><q id='zl0tf'><span id='zl0tf'><b id='zl0tf'><form id='zl0tf'><ins id='zl0tf'></ins><ul id='zl0tf'></ul><sub id='zl0tf'></sub></form><legend id='zl0tf'></legend><bdo id='zl0tf'><pre id='zl0tf'><center id='zl0tf'></center></pre></bdo></b><th id='zl0tf'></th></span></q></dt></tr></i><div id='zl0tf'><tfoot id='zl0tf'></tfoot><dl id='zl0tf'><fieldset id='zl0tf'></fieldset></dl></div>
        <bdo id='zl0tf'></bdo><ul id='zl0tf'></ul>
      1. <tfoot id='zl0tf'></tfoot>
      2. <legend id='zl0tf'><style id='zl0tf'><dir id='zl0tf'><q id='zl0tf'></q></dir></style></legend>

        Xcode 6 错误 - “缺少所需的架构 i386"为 iOS 模拟器构建时

        时间:2023-05-17

          <tbody id='DHNNd'></tbody>

      3. <i id='DHNNd'><tr id='DHNNd'><dt id='DHNNd'><q id='DHNNd'><span id='DHNNd'><b id='DHNNd'><form id='DHNNd'><ins id='DHNNd'></ins><ul id='DHNNd'></ul><sub id='DHNNd'></sub></form><legend id='DHNNd'></legend><bdo id='DHNNd'><pre id='DHNNd'><center id='DHNNd'></center></pre></bdo></b><th id='DHNNd'></th></span></q></dt></tr></i><div id='DHNNd'><tfoot id='DHNNd'></tfoot><dl id='DHNNd'><fieldset id='DHNNd'></fieldset></dl></div>

          • <bdo id='DHNNd'></bdo><ul id='DHNNd'></ul>
              <tfoot id='DHNNd'></tfoot>
                  <legend id='DHNNd'><style id='DHNNd'><dir id='DHNNd'><q id='DHNNd'></q></dir></style></legend>
                • <small id='DHNNd'></small><noframes id='DHNNd'>

                • 本文介绍了Xcode 6 错误 - “缺少所需的架构 i386"为 iOS 模拟器构建时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我创建了一个自定义的 Objective-C 框架.我想将它导入任何给定的 iOS 项目,并在 iOS 模拟器和实际设备上使用它提供的功能.为了导入框架,我使用应用程序目标中的 Build Phases > Link Binary With Libraries 设置来链接它.然后,我可以使用以下语句将其导入我的一个类中:

                  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.

                  为了让应用程序在设备上构建,我遵循 这个 SO答案.我没有链接框架,而是在目标的 Build Phases 设置中添加了一个新的 Copy Files 阶段,将 Destination 设置为 Framework,然后添加了我的框架.

                  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.

                  请注意,我正在尝试在一个新的 Xcode 项目中使用我的自定义框架,因此没有更改任何应用程序/构建设置的默认设置.

                  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 模拟器和项目中包含我的框架的设备上运行我的应用程序?任何见解将不胜感激!

                  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!

                  推荐答案

                  问题是框架没有针对 iOS Simulator 的架构编译,即 i386.Xcode 只为目标架构编译一个框架,所以如果我为 iOS 模拟器构建框架,它不会在设备上工作,如果我为设备构建框架,它不会在 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.

                  这篇关于Xcode 6 错误 - “缺少所需的架构 i386"为 iOS 模拟器构建时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:我可以构建一个 ARC 框架并在非 ARC 项目中使用它吗? 下一篇:未找到自动链接框架

                  相关文章

                  <legend id='Aw4E9'><style id='Aw4E9'><dir id='Aw4E9'><q id='Aw4E9'></q></dir></style></legend>

                    <i id='Aw4E9'><tr id='Aw4E9'><dt id='Aw4E9'><q id='Aw4E9'><span id='Aw4E9'><b id='Aw4E9'><form id='Aw4E9'><ins id='Aw4E9'></ins><ul id='Aw4E9'></ul><sub id='Aw4E9'></sub></form><legend id='Aw4E9'></legend><bdo id='Aw4E9'><pre id='Aw4E9'><center id='Aw4E9'></center></pre></bdo></b><th id='Aw4E9'></th></span></q></dt></tr></i><div id='Aw4E9'><tfoot id='Aw4E9'></tfoot><dl id='Aw4E9'><fieldset id='Aw4E9'></fieldset></dl></div>
                      <bdo id='Aw4E9'></bdo><ul id='Aw4E9'></ul>

                    <tfoot id='Aw4E9'></tfoot>

                    1. <small id='Aw4E9'></small><noframes id='Aw4E9'>