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.
Related
I have made my own fat framework that I distribute over Cocoapods.
But when I try to upload an app with bitcode enabled using my framework, I am rejected with error ITMS-90635, see:
I want my framework to be compatible with bitcode, so I set ENABLE_BITCODE=YES, BITCODE_GENERATION_MODE=bitcode (also tried with OTHER_CFLAGS="-fembed-bitcode" in addition) when building the framework.
Here is how I build my framework:
[...]
echo "Clean ${TARGET_NAME} for simulator"
xcodebuild -workspace ${WORKSPACE_NAME}.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' -scheme ${SCHEME} CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode clean
echo "Clean ${TARGET_NAME} for generic device"
xcodebuild -workspace ${WORKSPACE_NAME}.xcworkspace -configuration ${CONFIGURATION} -destination generic/platform=iOS -scheme ${SCHEME} CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode clean
echo "Build ${WORKSPACE_NAME} for simulator"
xcrun xcodebuild -workspace ${WORKSPACE_NAME}.xcworkspace -scheme ${SCHEME} -configuration ${CONFIGURATION} -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' -sdk iphonesimulator CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode
echo "Build ${WORKSPACE_NAME} for generic device"
xcrun xcodebuild -workspace ${WORKSPACE_NAME}.xcworkspace -scheme ${SCHEME} -configuration ${CONFIGURATION} -destination generic/platform=iOS -sdk iphoneos CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode
[...]
lipo -create "${DEVICE_BIN}/${TARGET_NAME}" "${SIMULATOR_BIN}/${TARGET_NAME}" -output "${UNIVERSAL_PATH}/${TARGET_NAME}.framework/${TARGET_NAME}"
What I really do not understand is that my framework seems to have bitcode enabled, see:
Am I doing something wrong when building my framework?
Ok, I finally found what was wrong :)
Once lipo done, I used to copy/paste
Build/Products/Release-iphoneos/MyFramework.framework/Modules/MyFramework.swiftmodule/
into
Build/Products/Release-iphonesimulator/MyFramework.framework/Modules/MyFramework.swiftmodule/
and then I was distributing this final framework:
Build/Products/Release-iphonesimulator/MyFramework.framework.
Do the opposite! Once lipo done, copy/paste MyFramework.swiftmodule/'s Release-iphonesimulator/ into the Release-iphoneos/ one and distribute the .framework in Release-iphoneos/.
I'm building a framework for my company. I have a workspace with two projects inside, the Cocoa Touch Framework and the Example app. I've a Run Script, that runs every time I build my framework, that builds simulator and device version and then lipo them to create fat framework. All of this is distributed via Cocoapods, so I've set the vendored_frameworks attribute on the podspec and so on. Everything installs correctly in other projects, except for one thing : it's impossible to archive projects because the framework does not contain bitcode. These are my xcodebuild command (in the run script) :
# Build both device and simulator versions for iOS
xcodebuild BITCODE_GENERATION_MODE=bitcode -project "${PROJECT_DIR}/${PROJECT_NAME}.xcodeproj" -derivedDataPath "${BUILD_DIR}" -scheme "${PROJECT_NAME}" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone X' clean build
xcodebuild BITCODE_GENERATION_MODE=bitcode -project "${PROJECT_DIR}/${PROJECT_NAME}.xcodeproj" -derivedDataPath "${BUILD_DIR}" -scheme "${PROJECT_NAME}" -sdk iphoneos clean build
I set the build configuration to Release, so it does not use Debug. However, always the same problem : no way to archive an app with this framework inside.
Do you have any suggestion?
There are 2 options:
1.Try this to build your framework wth bitcode:
xcodebuild BITCODE_GENERATION_MODE=bitcode OTHER_CFLAGS="-fembed-bitcode" -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild BITCODE_GENERATION_MODE=bitcode OTHER_CFLAGS="-fembed-bitcode" -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
2.Or you opt to disable bitcode in your application
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
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?
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