How to create ios Xcodeproject using terminal - ios

Hello I wanted to write script for xcode project creation,building and running into emulator for generic development,I tried so many ways but no result,using terminal cordova(phonegap) is creating,building and running xcode project in emulator.How they are handling,please help me to resolve this.
If i create project through xcode how can i add html and image files to xcode using terminal
for building xcode project:
xcodebuild -target ‘AppName.xcodeproj’ -scheme ‘AppName’ -configuration “Debug/Release” -sdk iphoneos6.0/5.0/4.0 -arch “armv7 armv7s” CONFIGURATION_BUILD_DIR=’BuildDirectoryName‘ ONLY_ACTIVE_ARCH=NO/YES

Related

Building project using xcodebuild fails with Xcode 7.2

I just moved to Xcode 7.2 and am trying to compile a dynamic framework using xcodebuild and lipo
xcodebuild -project ProjectName.xcodeproj -scheme ProjectName -sdk iphonesimulator
This command fails with strange errors like Unsupported architecture (in frameworks like CoreText). The issue has also been discussed here but I don't see a solution which would work. Any help?
This is due to a bug in Xcode 7.2 (and 7.2.1).
A workaround suggestion has been provided in the supplied link since this question was asked. To sum up, you can add the parameter PLATFORM_NAME=iphonesimulator, and then it magically works. For example:
xcodebuild -project ProjectName.xcodeproj -scheme ProjectName -sdk iphonesimulator -arch i386 PLATFORM_NAME=iphonesimulator build
See also my answer here (where there is also another suggestion for a workaround)

How to build a release version of an iOS framework in Xcode?

Let's say I do the following:
Open Xcode 7
File | New | Project | Cocoa Touch Framework
Create "TestFramework" with the Swift language
Create a file Hello.swift with public func hello() { print("Hello") }.
From here, I can build a debug build of the framework (inside the Debug-iphoneos folder), but I cannot figure out how to build the release version of the framework (inside Release-iphoneos). I thought Archive might do it, but it doesn't. Pointers please?
To get a release build, you need to change your scheme settings:
Alternatively, create a new scheme for release builds.
Ensure you have a device selected. Not the simulator.
Build your project and you should see that it gets added to this location:
(Click the arrow to navigate there in finder)
And after drilling down, you should be able to find the release folder with your release framework inside.
This works for me:
Select your framework target then click Product -> Archive. If organizer window does not pop up after successful build of your framework then go to "Build Settings" of your framework target, look for the option "Skip Install" and change it to "No" (and after that Archive again).
An alternative to building a framework via the Xcode IDE is to build it from the command line.
You can produce a release build of your framework for iphoneos devices with the following command:
xcodebuild -workspace TestSDK.xcworkspace -scheme TestSDK -configuration Release -sdk iphoneos
You can change the value of the -configuration argument from Release to Debug in order to produce a debug build, or change the value of the -sdk argument from iphoneos to iphonesimulator in order to produce a build for Simulator devices.
Note that you may need to provide the -project argument instead of -workspace if your target is part of an Xcode project only and not part of an Xcode workspace. Run the xcodebuild -help command for the full list of xcodebuild options.
If you prefer to archive, you can do that from the command line also, as follows:
xcodebuild archive -workspace TestSDK.xcworkspace -scheme TestSDK -configuration Release -sdk iphoneos -archivePath "TestSDK_Release_iphoneos.xcarchive" SKIP_INSTALL=NO
Note that you can specify SKIP_INSTALL=NO as part of your project or target's Build Settings instead if you prefer.
Lastly, if you want to join up your iphoneos and iphonesimulator builds into a single binary, you can do that with the xcodebuild -create-xcframework command as follows:
xcodebuild -create-xcframework \
-framework "TestSDK_Release_iphoneos.xcarchive/Products/Library/Frameworks/TestSDK.framework" \
-framework "TestSDK_Release_iphonesimulator.xcarchive/Products/Library/Frameworks/TestSDK.framework" \
-output "TestSDK.xcframework"
See here for the official guide to creating an XCFramework.
When you add the framework to your other Xcode project then you have to add "$(BUILT_PRODUCTS_DIR)" to Build Settings -> Framework Search Paths.
This will create Debug when you run project (with Debug) and will create Release version when you archive project.
The archive doesn't will create Release version under Products dir but will create Release in "Intermediates.noindex" folder.

"You can’t open the application because it is not supported on this type of Mac." xcodebuild

When I try to build my xcode project using the following command:
xcodebuild -workspace "Converse.xcworkspace" -sch
eme "Converse" -configuration “Debug” -sdk iphonesimulator7.1 -arch i386 ONLY_
ACTIVE_ARCH=NO
It builds fine, but when I try to double click on the app it generates, it says: You can’t open the application because it is not supported on this type of Mac. Does anyone know why this is happening?
iOS apps need the simulator to run. You can just, as you said run them from Xcode. If you do not have the project then you need to deploy them like :
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication /Path/ToIso.app/AppName
Use Xcode, not xcodebuild, to run your app on the simulator.

Compiling OpenCV 2.4.5 in xcode 4.6.2 for iOS

I've been trying to build opencv framework for ios using the steps in the readme file in the ios directory:
Assuming that your build directory is on the same level that opencv source,
From the build directory
run
../opencv/ios/configure-device_xcode.sh
Then from the same folder invoke
xcodebuild -sdk iphoneos -configuration Release -target ALL_BUILD
xcodebuild -sdk iphoneos -configuration Release -target install install
I have followed these steps and the scripts say they have completed successfully but the folder which should contain the completed framework is incomplete.
Can anyone confirm that they have successfully built the opencv ios framework 2.4.5 with xcode 4.6.2?
I'm not sure but could be related to this question:
Command xcodebuild failing to copy
There is now a Python script which will generate the framework with much less effort. From the ios directory, run
./build_framework.py <outputdir>
where <outputdir> is the path to where the framework will be built.

xcodebuild doesn't work when specifying -sdk option

I'm trying to manually compile an xcode project and I can't manage to compile it using xcodebuild when I specify an SDK through the -sdk option.
This fails:
/usr/bin/xcodebuild -project "libjpeg.xcodeproj" -configuration "Release" -sdk iphonesimulator -arch i386 CONFIGURATION_BUILD_DIR=build build
and this works:
/usr/bin/xcodebuild -project "libjpeg.xcodeproj" -configuration "Release" -arch i386 CONFIGURATION_BUILD_DIR=build build
I have installed XCode 4.3.3 and Command line tools from the Apple's developer page, and everything else it's working without problems. If I build this project using XCode, it works without problems too. There's no other xcode version in my system.
I should have something really broken in my env, but I can't manage to find it. I'd appreciate any hints you could give me.
You need to specify something like -sdk iphonesimulator6.0
See this answer: parameter for xcodebuild for using latest sdk.

Resources