Xcode 6 iOS创建Cocoa Touch Framework - 架构问题 [英] Xcode 6 iOS Creating a Cocoa Touch Framework - Architectures issues

查看:208
本文介绍了Xcode 6 iOS创建Cocoa Touch Framework - 架构问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为iOS应用程式建立动态架构。由于新版本的Xcode(6),我们可以选择一个Cocoa Touch Framework,当我们创建一个新的项目,没有更多的需要添加一个聚合目标,运行脚本等。我没有问题,当我构建框架。但是当我试图在iOS应用程序中使用它时,我得到一些架构问题。

I'm trying to make a dynamic framework for an iOS app. Thanks to the new version of Xcode (6) we can select a Cocoa Touch Framework when we create a new project and there is no more need to add an aggregate target, run script and so to make one. I have no issue when i build the framework. But when I'm trying to use it inside an iOS app I get some architectures issues.

ld: warning: ignoring file /Library/Frameworks/MyFramework.framework/MyFramework, file was built for x86_64 which is not the architecture being linked (arm64): /Library/Frameworks/MyFramework.framework/MyFramework
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_MyFrameworkWebService", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

ld: warning: ignoring file /Library/Frameworks/MyFramework.framework/MyFramework, file was built for x86_64 which is not the architecture being linked (armv7): /Library/Frameworks/MyFramework.framework/MyFramework
Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_MyFrameworkWebService", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已经尝试改变框架项目和目标的设置(Architectures&仅构建有效的架构&有效架构)。我为iOS应用程序做了同样的事情,但没有什么工作。我想有一些我不明白的东西。

Well I have tried to change the settings of the framework project and target (Architectures & Build valid architecture only & Valid architectures). I've done the same thing for the iOS app project but nothing works. I think there is something I didn't understand.

例如当我建立一个框架只有i386(iOS模拟器)检查命令行
xcrun lipo -info MyFramework,我有一个问题,

For example when I build a framework for only i386 (iOS Simulator) check with the command line "xcrun lipo -info MyFramework", I have an issue that

ld:warning:忽略文件/Library/Frameworks/MyFramework.framework/MyFramework,文件是为x86_64构建的是不是被链接的架构(i386)...

ld: warning: ignoring file /Library/Frameworks/MyFramework.framework/MyFramework, file was built for x86_64 which is not the architecture being linked (i386)...

如果有人可以帮助我得到一个适用于所有iOS架构,包括模拟器的框架。

If someone can help me to get a framework that works for all iOS architectures including simulators.

推荐答案

根据所有回应, post on raywenderlich.com 以及由 gist =http://stackoverflow.com/users/2849/chris-conway>克里斯·康威我想出了这个

Based on all the responses, the post on raywenderlich.com and the gist created by Chris Conway I came up with this.

执行以下步骤我能够构建一个Cocoa Touch框架(包括Swift和Objective-C文件),其中包含模拟器和设备:

Executing the following steps I was able to build a Cocoa Touch framework (including Swift and Objective-C files) that contains all architectures for both simulator and device:


  1. 在框架项目中创建一个新的(汇总)目标

  2. 选择添加运行脚本,然后复制此文件的内容

  3. 在Scheme Selection下拉列表中选择汇总目标

  4. 为汇总方案创建目标

  1. Create a new (Aggregate) target in your framework's project
  2. Under "Build Phases" select "Add Run Script" and copy the contents of this file
  3. Select the Aggregate target in the Scheme Selection drop down
  4. Build the target for the aggregate scheme

希望它有帮助:)

UPDATE:修复了gist中的错误, #3不正确。感谢 Tokuriku

UPDATE: Fixed an error in the gist where the paths in step #3 were incorrect. Thanks to Tokuriku!!

这篇关于Xcode 6 iOS创建Cocoa Touch Framework - 架构问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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