I am trying to build Xcode project from command line, using iphonesimulator as SDK. Here is the command line:
xcodebuild -scheme SchemeName -configuration Debug -sdk iphonesimulator PLATFORM_NAME=iphonesimulator clean build
However, when I add a post-build action in Xcode like:
echo "PLATFORM_NAME: ${PLATFORM_NAME}"
it always outputs "PLATFORM_NAME: iphoneos" and not iphonesimulator.
Is this a bug, or there is something wrong in my build configuration? Thanks
Related
I am currently want to create a debug simulator build using xcodebuild command rather than xcode IDE.
however, I always see a "debug-iphoneos" folder is generated, which is for the real device. I expected the simulator output folder "Debug-iphonesimulator"
Can anyone take a look at my script and suggest why the script is not working for simulator?
xcodebuild -scheme "TestApp" -configuration "Debug" -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' -workspace TestApp.xcworkspace clean archive -archivePath build/TestApp PROVISIONING_PROFILE="$provisioningUUID" CODE_SIGN_IDENTITY="$codeSignIdentity"
now I can run successfully as below:
xcodebuild -arch i386 -sdk iphonesimulator9.3 -workspace "$app.xcworkspace" -scheme "$scheme" -configuration "Debug"
You should run the following instead:
xcodebuild -arch i386 -sdk iphonesimulator9.1 -workspace [name].xcworkspace -scheme [targetName or ProjectName] ONLY_ACTIVE_ARCH=NO VALID_ARCHS="i386 x86_64"
where iphonesimulator9.1 depends on which iPhone Simulator you installed.
i have created a framework
Now if reveal it in finder,
It have 2 directory having framework
iphoneos
iphone simmulater
Now i create an app, and drag my framework from iphoneos directory, it run fine in iphone device but gives error in simmulater.
similarely if i drag framework from iphone simulater it work fine in simmulater but give error in device.
Please how to export both directory framework in a combine.
i have try to run script of lipo using aggreation target, but it fails
please guide proper steps.
You can add similar script to your build settings Build Phase tab as Run Script
# debug sim
xcrun xcodebuild -project myFramework.xcodeproj -target myFramework -configuration Debug -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO
# release sim
xcrun xcodebuild -project myFramework.xcodeproj -target myFramework -configuration Release -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO
# debug ios
xcrun xcodebuild -project myFramework.xcodeproj -target myFramework -configuration Debug -sdk iphoneos ONLY_ACTIVE_ARCH=NO
# release ios
xcrun xcodebuild -project myFramework.xcodeproj -target myFramework -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO
mkdir -p build/Release-Universal/myFramework.framework
cp -r build/Debug-iphonesimulator/myFramework.framework/* build/Release-Universal/myFramework.framework/
rm build/Release-Universal/myFramework.framework/myFramework
# lipo
lipo -create build/Release-iphoneos/myFramework.framework/myFramework build/Release-iphonesimulator/myFramework.framework/myFramework -output build/Release-Universal/myFramework.framework/myFramework
i want to get my project's code coverage (which is managed by cocoapods), i run the following cmd :
xcodebuild -scheme KVODemo -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 6' -enableCodeCoverage YES -workspace KVODemo.xcworkspace test
but i can not find the Coverage.profdata file (for normal project which is not managed by cocoapods is under the $PROJECT_TEMP_ROOT/CodeCoverage/$PROJECT_NAME/Coverage.profdata)
i just want to know how to get the code coverage for cocoa pods project.
ok , after a detail look at the cmd xcodebuild , i noticed something.
here is some info in the "man xcodebuild":
xcodebuild -showBuildSettings
[-project name.xcodeproj |
[-workspace name.xcworkspace -scheme schemename]]
the $PROJECT_TEMP_ROOT i mentioned in my question is the result of
xcodebuild -showBuildSettings |grep PROJECT_TEMP_ROOT
and this should the same as the xcodebuild -showBuildSettings -project xxx.xcodeproj
because my project is managed by cocoa pods, so i should get the $PROJECT_TEMP_ROOT in this way :
xcodebuild -showBuildSettings -workspace xxx.xcworkspace -scheme xxx
and finally , find the Coverage.profdata in the $PROJECT_TEMP_ROOT/CodeCoverage/$PROJECT_NAME/Coverage.profdata
I'm using the command line to build all the targets in my project.
I have 3 targets in my project but the build file(.app) is getting created for one target.
Below is script
CONFIG="Ad Hoc"
SDK="iphoneos"
xcodebuild -alltargets -sdk "$SDK" -configuration "$CONFIG"
xcodebuild -project projectname.xcodeproj -alltargets
Have been running a scripted build without problems for a few months now instead of using XCode to do it. When I create a build with XCode, that build has the up to date version of the Settings.bundle.
Here's the key commands:
xcodebuild -workspace Proj_Name.xcworkspace -sdk "iOS 6.0" -scheme Proj_Name CODE_SIGN_IDENTITY="$DISTRIBUTION_CERTIFICATE" PROVISIONING_PROFILE="${PROVISONNING_PROFILE}"
xcodebuild -workspace Proj_Name.xcworkspace -sdk "iOS 6.0" -scheme Proj_Name CODE_SIGN_IDENTITY="$DISTRIBUTION_CERTIFICATE" PROVISIONING_PROFILE="${PROVISONNING_PROFILE}" archive
xcodebuild -workspace Proj_Name.xcworkspace -sdk "iOS 6.0" -scheme Proj_Name CODE_SIGN_IDENTITY="$DISTRIBUTION_CERTIFICATE" PROVISIONING_PROFILE="${PROVISONNING_PROFILE}" -configuration release
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${PROJECT_BUILDDIR}/Proj_Name.app" -o "${BUILD_HISTORY_DIR}/Proj_Name.ipa" --sign "$DISTRIBUTION_CERTIFICATE" --embed "${PROVISONNING_PROFILE}"
Am I missing a command to rebuild the Settings.bundle or something of that nature?