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

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

问题描述

我正在尝试为 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)

好吧,我已尝试更改框架项目和目标的设置(架构和仅构建有效架构和有效架构).我为 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: 警告:忽略文件/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.

推荐答案

对不起,我让这个话题打开了这么长时间......你们中的一些人已经正确回答了我的问题.当我写这个问题时,我没有注意到完整(也称为胖)框架(准备使用)中有两个切片.一种用于 iOS 设备,一种用于模拟器.当我发现我用lipo命令制作了一个脚本来融合两个切片,自动得到一个完整的框架.

Sorry I've let this topic open for such a long time... Some of you has correctly answered to my question. When I wrote this question I didn't catch there were two slices in a complete (also called fat) framework (ready to use). One for the iOS devices and one for the simulator. When I discovered that I made a script using lipo command to fusion the two slices and got automatically a complete framework.

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

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