如何将现有的 Xcode 目标从动态更改为静态? [英] How do I change an existing Xcode target from dynamic to static?

查看:35
本文介绍了如何将现有的 Xcode 目标从动态更改为静态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个生成动态库 (Cocoa API) 的现有项目.

I'm working with an existing project that produces a dynamic library (Cocoa API).

我宁愿生成一个静态库,但如果我改变[Linking|Mach-O Type] 字段从动态库"到静态库",Clean Project 和 Build Project 都抱怨说目标具有无效的 MACH_O_TYPE 值staticlib".

I'd rather generate a static library, but if I change the [Linking|Mach-O Type] field from "Dynamic Library" to "Static Library", both the Clean Project and Build Project complain that the target has an invalid MACH_O_TYPE value of 'staticlib'.

有没有一种直接的方法可以让构建生成静态 .a 文件?

Is there a straightforward way to get the build to produce a static .a file?

谢谢,
埃里克

推荐答案

使用 TextEdit 打开 YourProjectName.xcodeproj 文件夹中的 project.pbxproj 文件,搜索 productType 并将其值从com.apple.product-dynamic"更改为com.apple.product-static"

Opens up the project.pbxproj file in YourProjectName.xcodeproj folder using TextEdit, search for productType and change it's value from "com.apple.product-dynamic" to "com.apple.product-static"

这篇关于如何将现有的 Xcode 目标从动态更改为静态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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