我需要从命令行将标题和库添加到项目文件中.(需要更改项目文件)
我看上去project.pbxproj它看起来不友好:)
是否存在正确添加文件到xcodeproj的方法?当然它只能在MACOS中运行.
谢谢,
当我使用命令行工具xcodebuild(XCode 4.2.1 - iOS SDK 5.0)随机编译我的应用程序时ibtoold(Interface Builder)崩溃.当我重新运行构建时,一切正常.
发生以下错误:
ibtoold[88134:107] [MT] DVTAssertions: ASSERTION FAILURE in /SourceCache/IDEInterfaceBuilderCocoaTouch/IDEInterfaceBuilderCocoaTouch-933/IBPlugin/Utilities/IBObjectMarshalling.m:499
Details: Interface Builder encountered an error communicating with the iOS Simulator. If you choose to file a crash report or radar for this issue, please check Console.app for crash reports for "Interface Builder Cocoa Touch Tool" and include their content in your crash report.
Exception name: NSInvalidReceivePortException
Exception reason: connection went invalid while waiting for a reply because a mach port …Run Code Online (Sandbox Code Playgroud) 我正在使用xcodebuildXcode3附带的实用程序来自动化我在Hudson下的构建.该命令如下所示:
xcodebuild -project Project.xcodeproj -target Target -configuration Release -sdk iphoneos CODE_SIGN_IDENTITY[sdk=iphoneos*]="iPhone Distribution:XXXXXX"
Run Code Online (Sandbox Code Playgroud)
我正在尝试对Xcode4使用相同的命令,但似乎xcodebuild只是忽略了CODE_SIGN_IDENTITY参数和符号,其中包含为Xcode中的目标选择的配置文件.
这对我来说非常重要,因为我必须使用3-4个不同的配置文件签署构建.它适用于Xcode3,但不适用于Xcode4.
知道如何解决这个问题吗?
我正在尝试使用Jenkins CI(在带有Mavericks的Mac Mini上)使用该xcodebuild命令来构建我的iOS项目.我玩了好几个小时,但是无法理解这个问题.
以下命令在命令行上构建我的项目没有任何问题,但在Jenkins中运行时失败.
xcodebuild -workspace ./MyProject.xcworkspace
-scheme MyProject
-configuration AdHoc
-sdk iphoneos
DSTROOT=/Users/me/myproject
OBJROOT=/Users/me/myproject
SYMROOT=/Users/me/myproject
ONLY_ACTIVE_ARCH=NO
OTHER_CODE_SIGN_FLAGS="--keychain /Users/me/Library/Keychains/temporary.keychain"
Run Code Online (Sandbox Code Playgroud)
(为了清晰起见,添加了换行符.)
错误总是看起来像这样:
CompileC /Users/me/myproject/MyProject.build/AdHoc-iphoneos/MyProject.build/Objects-normal/armv7/SomeViewController.o MyProject/Code/Controllers/Event/SomeViewController.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/me/.jenkins/jobs/myproject/workspace
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache -Wno-trigraphs -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign …Run Code Online (Sandbox Code Playgroud) 我们有一个API,用户可以调用它来创建Cordova应用程序/项目,上传他们的www目录,然后开始编译并下载可执行二进制文件.然后,此二进制文件将进入私有应用商店.
我在使用iOS的编译步骤时遇到了麻烦.Cordova构建步骤没有问题,但它不会像Android那样输出二进制文件.在阅读了我在Stackoverflow和其他地方发现的所有内容后,计划如下:
xcodebuild clean -configuration Release -alltargets
xcodebuild -scheme MyApp archive -archivePath build/MyApp
xcodebuild -exportArchive -exportFormat ipa -archivePath "build/MyApp.xcarchive" -exportPath "MyApp.ipa" -exportProvisioningProfile "My Prov Profile"
Run Code Online (Sandbox Code Playgroud)
鉴于签名身份和所有内容都已正确设置,它几乎可以正常工作.第一个命令执行正常.第二个命令就是挂起.
但是,如果我在Xcode中打开项目,然后执行命令,它会编译并导出,我留下了一个.ipa文件,这就是我想要的.在首次打开项目时,Xcode似乎设置了一个工作空间和一些与方案相关的东西.
有没有什么办法可以让xcodebuild(或xcrun,或其他任何东西)为我创建这个工作区文件?
还是有另一种方法来解决这个问题吗?
现在,我有一个解决方案,我实际打开Xcode项目,等待15秒,然后继续.但是我可以想到在某些方面会失败的千种方法,所以我想把它改成更优雅的东西.
我目前安装了Xcode 6.3,如果这是相关的.
更新:Opal的回答让我走上正确的道路(我想).我最终做的是按照Opal的链接导出共享方案,并将其用作未来应用的模板.解决方案是这样的:
# Copy shared scheme file into directory
mkdir /path/to/project/dir/MyApp.xcodeproj/xcshareddata
mkdir /path/to/project/dir/MyApp.xcodeproj/xcshareddata/xcschemes
cp data/MyScheme.xcscheme /path/to/project/dir/MyApp.xcodeproj/xcshareddata/xcschemes/.
# Use sed to replace app name in scheme file
sed -i '' "s/%app_name%/MyApp/g" MyApp.xcodeproj/xcshareddata/xcschemes/MyScheme.xcscheme
# CD into directory
cd /path/to/project/dir
# Move files from Cordova to our build directory
cp -r CordovaLib/build/* …Run Code Online (Sandbox Code Playgroud) 我刚刚将我的Xcode更新到7.2版.现在我尝试使用xcodebuild从命令行构建一个框架但是有这个错误
.... /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTiming.h:6:9: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTiming.h:6:
#import <QuartzCore/CABase.h>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h:11:10: error: could not build module 'Darwin'
#include <stdbool.h>
^
/Users/atran/Desktop/Repos/DSA_Working_Directory/Libs/Kingfisher/Kingfisher/Kingfisher.h:27:9: note: while building module 'UIKit' imported from /Users/atran/Desktop/Repos/DSA_Working_Directory/Libs/Kingfisher/Kingfisher/Kingfisher.h:27:
#import <UIKit/UIKit.h>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UICollectionViewLayout.h:11:9: note: while building module 'QuartzCore' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UICollectionViewLayout.h:11:
#import <QuartzCore/CATransform3D.h>
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAEAGLLayer.h:7:9: note: while building module 'OpenGLES' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAEAGLLayer.h:7:
#import <OpenGLES/EAGLDrawable.h>
^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/EAGL.h"
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/EAGL.h:8:10: error: could not build module 'Foundation'
#include <Foundation/Foundation.h>
^ …Run Code Online (Sandbox Code Playgroud) 首先,我想声明没有bitcode,一切都很完美.当我打开应用程序中的"bitcode"标志时,问题就出现了.
此外,所有构建都是通过CI流(不是手动在xcode-> archive et.al中).
该框架是在与应用程序本身分开的流程中构建的(该应用程序嵌入了编译的框架)
当我尝试打包ipa时,我收到此错误:
❌ld:bitcode bundle无法生成,因为'..../Framework.framework/Framework'是在没有完整bitcode的情况下构建的.bitcode的所有框架和dylib必须从Xcode Archive或Install build for architecture armv7生成
❌clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)
关于框架:
我正在使用以下命令构建框架:(省略技术细节)
# iphone (arm)
xcodebuild -configuration Release -sdk iphoneos CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
# iphone (simulator)
xcodebuild -configuration Release -sdk iphonesimulator CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
Run Code Online (Sandbox Code Playgroud)
然后脂肪(FAT二进制)
lipo -create /Release-iphonesimulator/Framework.framework/Framework -output /Universal/Framework.framework/Framework
Run Code Online (Sandbox Code Playgroud)
我已经将编译器标志添加到框架中以"嵌入bitcode"
我甚至"验证"它有其他所有问题的bitcode :( 编译启用了bitcode的iOS库)
另外,检查二进制文件是否包含bitcode的最简单方法是使用otool和grep:
otool -l binary_name | grep __LLVM
你会看到一个或多个segname __LLVM条目,如果它有bitcode或空输出,如果没有.
otool -arch arm64 -l Frameworks/Framework.framework/Framework | grep __LL
segname __LLVM
segname __LLVM
Run Code Online (Sandbox Code Playgroud)
我还尝试了添加编译标志的其他变体
xcodebuild OTHER_CFLAGS="-fembed-bitcode"
Run Code Online (Sandbox Code Playgroud)
并报告给我相同的错误
我有一个需要测试的 SPM 项目xcodebuild(因为它具有 XIB 等 iOS 资源)。该项目还支持 Cocoapods,因此它也有.xcodeproj和.xcworkspace文件。
通常 xcodebuild 会自动检测该Package.swift文件并使用它来构建,但现在它会检测 Cocoapods 工作区并尝试从该工作区开始。
我通读了 的文档xcodebuild,但找不到明确将其指向 Package.swift 的标志。
是否有任何相当于--project或--workspace标志的东西可以用来告诉 xcodebuild 使用该Package.swift文件并忽略项目和工作区?
当我想运行任何xcodebuild操作时,它会给出以下错误,而 Xcode ide 在 Apple M1 上运行良好。
> xcodebuild -version
objc[72320]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1dc35ab90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x105ca42c8). One of the two will be used. Which one is undefined.
objc[72320]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1dc35abe0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x105ca4318). One of the two will be used. Which one is undefined.
Xcode 13.2.1
Build version 13C100
Run Code Online (Sandbox Code Playgroud)
这两个类都是在/usr/lib/libauthinstall.dylib另一个模块中实现的,所以我想检查/usr/lib/libauthinstall.dylib但它无法访问
> open /usr/lib/libauthinstall.dylib
The file /usr/lib/libauthinstall.dylib does not exist.
Run Code Online (Sandbox Code Playgroud) 考虑这个示例项目: https: //github.com/stremsdoerfer/TestPlan。这只是一个 Hello World,它有两个测试计划:TestPlanUnit仅运行单元测试和TestPlanUI仅运行 UI 测试。
使用 Xcode 14.3 运行下面的命令,我希望TestPlanUI能够运行,但实际上只是TestPlanUnit默认运行。
xcodebuild -scheme TestPlan -destination 'platform=iOS Simulator,id=<sim_id>' -testPlan TestPlanUI test-without-building
Run Code Online (Sandbox Code Playgroud)
它在 Xcode 14.2 上运行良好。使用test代替test-without-building也可以正常工作。
有什么想法吗?