为iOS模拟器创建dylib [英] Creating a dylib for iOS simulator

查看:88
本文介绍了为iOS模拟器创建dylib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ObjectiveC项目项目,我已经使用Ray Wenderlich的出色文章在这里创建了一个通用静态库:

I have an ObjectiveC project project that I've managed to create a universal static library using Ray Wenderlich's excellent article here:

https://www.raywenderlich.com/41377/在iOS教程中创建静态库

这允许您从Xcode中完成所有操作.我还想使用相同的项目为iOS Simulator创建一个dylib.

Which allows you to do it all from within Xcode. I also want to create a dylib for iOS Simulator using the same project.

我碰到了这个链接,用于从通用静态库中提取一个切片,并创建一个dylib:

I came across this link for extracting a slice from the universal static library, and creating a dylib:

https://pewpewthespells.com/blog/convert_static_to_dynamic.html

除了它没有指定为模拟器创建dylib的选项(默认为OSX)之外,而且我在寻找针对iOS模拟器的正确选项方面遇到了麻烦.

Except that it doesn't specify the options for creating a dylib for simulator (the default is for OSX), and I'm having trouble finding exactly what the right options are for targeting iOS Simulator.

我假设如果我有正确的选择,我可以将其添加到脚本的末尾(摘自Ray的文章).关于我能做什么的任何线索?

I'm assuming that if I do have the right options, I could add this to the end of the script (from Ray's article). Any clues as to what I could do?

推荐答案

我设法自己(最终)解决了这个问题:-)诀窍是:

I've managed to sort this one out myself (eventually) :-) The trick was to:

使用File | New | Target在Xcode中添加另一个目标,然后从OSX/Framework&中选择Library.图书馆的物品.

Add another target in Xcode, by using File|New|Target, and select Library from the OSX/Framework & Library items.

在新目标的构建设置"中:

In the Build Settings for the new target:

在架构"部分中,由于此dylib仅用于i386模拟器,因此在架构"项中添加了i386,并删除了其他内容,并对有效架构进行了同样的操作

In the Architectures section, since this dylib destined for just i386 simulator, in I added i386 to the Architectures item, and removed the others, and did the same for Valid Architectures

我将基本SDK设置为iOS9.3

I set the Base SDK to iOS9.3

我将支持的平台更改为iOS

I changed the Supported Platforms to iOS

由于我不想在Mac上使用dylib,因此在部署"部分中将跳过安装"设置为是"

Since I didn't want the dylib put on the Mac, in the deployment section I set Skip Install to Yes

为了使安装名称没有特定的路径,在链接部分,我将动态库安装名称库更改为@rpath

So that the install name doesn't have a specific path, in the linking section, I changed the Dynamic Library Install Name Base to @rpath

我也不希望Xcode向dylib添加前缀,因此在包装"部分中,我删除了可执行前缀"值

I also didn't want Xcode to add a prefix to the dylib, so in the Packaging section I removed the Executable Prefix value

我可能会进行一些设置,但结果却是我想要的.

I may have above and beyond with a couple of the settings, however the result is what I desired.

这篇关于为iOS模拟器创建dylib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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