I have an iPhone SDK project that is supposed to build a static library for both the simulator and the ARM processor and then combine the two into a universal library.
Heretofore, I was using iPhone SDK 3+ and accomplished this by creating a separate target for each, one simulator and one ARM, and then making a third target that combines them using a shell script. The deployment targets/build settings for each of the constituent targets are set to their respective architectures, etc. Also, iPhone SDK 3+ allowed me to select "Base SDK" from the drop down menu in the upper-left corner of the main XCode window.
Everything worked famously--then I upgraded to SDK 4.
Now, there is no "Base SDK" listing in the drop down menu in the upper-left. Also, the compiler seems to ignore the target deployment settings entirely. Even though one of the targets is set to "iPhone Device" and the other is set to "iPhone Simulator", they still build as whatever is set in the drop down menu.
In case I've not been clear enough, here is the offensive offending aforementioned menu we all know and love:
Once again, in SDK 3 everything worked perfectly. Now in SDK 4, if it's set to "Device" I get two libraries built for ARM. If it's set to simulator, I get two libraries built for the simulator.
Anybody know of a workaround for this bullhonkey?
Thanks much.
UPDATE: the "xcodebuild" command line tool still works, that is to say it will build the correct architecture according to each target's deployment parameters.
Thus, rather than using XCode's GUI to build, I can use a shell script that calls xcodebuild like so:
xcodebuild -target device-target -configuration Debug
xcodebuild -target sim-target -configuration Debug
It'd still be nice to find a real solution, but this will get the job done for now.
Yeah, Apple seems to be frobbing all the XCode controls and options. It's gotten to the point that I don't install Beta SDKs at all or GM/public SDKs if I'm close to finishing an app. I know the upgrade will break something.
Anyway, you should be able to create an External Target or Shell Script Target that builds each and links the libs together. I have a similar shell script for my bag-o-tricks library. In the XCode Project settings, I have set the BaseSDK to the iPhone Device 4.0 SDK. The build script looks roughly like:
xcodebuild -parallelizeTargets -configuration Debug -sdk iphoneos4.0 -target StaticLibs
xcodebuild -parallelizeTargets -configuration Debug -sdk iphonesimulator4.0 -target StaticLibs
xcodebuild -parallelizeTargets -configuration Release -sdk iphoneos4.0 -target StaticLibs
xcodebuild -parallelizeTargets -configuration Release -sdk iphonesimulator4.0 -target StaticLibs
mkdir -p build/Debug-dist build/Release-dist
lipo build/Debug-iphoneos/libfoo.a build/Debug-iphonesimulator/libfoo.a -create -output build/Debug-dist/libfoo.a
lipo build/Release-iphoneos/libfoo.a build/Release-iphonesimulator/libfoo.a -create -output build/Release-dist/libfoo.a
OK, I confess, this is an unrolled version. My actual script has a bunch of for thing in ${LIST_OF_STUFF}; do ... loops to better automated the builds, copy all the include files, and roll up a whole SDK.
I submitted a patch to Core-Plot to automate the creation of an SDK for them. If you use this patch as a reference, remove the GCC_VERSION key/value pair from the SDKSettings.plist or apps building against it will fail.
As far as I understand it, the "Base SDK" in the settings should be the highest possible in the SDK and the "iPhone OS Deployment Target" (also in settings) should be the lowest you need.
So, for example, if you'd want to compile an app for iPhone OS 3.1.2 and above you would have to set the "Base SDK" to 4.0 and "iPhone OS Deployment Target" to 3.1.2 .
On the iPhone sdk 4.0 apple removed every version of iOS lower than 3.2. If you build for iPhone, it automatically builds for 4.0, and if you build for iPad, it will compile as 3.2.
Related
I am attempting to run the iOS simulator from the command line. I have found the location where the iPhone Simulator can be run from. My question is whether or not it can receive parameters to specify which device should be launched and what app it should run.
$ ./Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone\ Simulator
Does anyone know if there are tricks to this. Knowing more about this would really help with our Continuous Integration process.
We now use WaxSim to automate our iOS applications during CI Builds
Use the -SimulateApplication argument to run your executable in the simulator (executable inside the .app bundle)
(you could also compile the project from the command-line like this:)
xcodebuild -project Test.xcodeproj -arch i386 -sdk iphonesimulator
Then for example:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication Test.app/Test
or
./Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication Test.app/Test
To launch a specific device you can do:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateDevice "iPhone Retina (3.5-inch)"
Try this in your shell for Xcode 6
osascript -e 'activate application "iOS Simulator"'
For Xcode 7
osascript -e 'activate application "Simulator"'
If you want to open Simulator with specific app installed then you can use some of the ready utility to launch simulator. This way it is easy to install the app and run on the simulator. This are the command line utilities that can be run from Terminal Window.
iPhoneSim
ios-sim
Other are same as above two.
And main thing is all uses same approach to open simulator. (see the project for more details)
Other way (not recommended by me) use script file to run from command.
You can use xcrun simctl to list available simulators, launch applications, etc. This tool is present in both Xcode 7 and Xcode 8. If you don't give it a command it will print command line help.
xcrun simctl launch <UUID> <bundle id of app> will start the application.
Just installed Xcode 4.2 for Snow Leopard and started to developer a new project. The app successfully runs on iPhone4 but isn't on iPhone3G. The code gets build, compiled, ran and finished. I just get a message "Finished running ...". Here's the settings that I have set both on Project and Target Build settings:
Build otions->GCC_VERSION = Apple LLVM 3
Architectures->ARCHS = "armv6 armv7"
Architectures->SDKROOT = "Latest iOS5"
Deployment->IPHONEOS_DEPLOYMENT_TARGET = "iOS 3.1"
Linking->OTHER_LDFLAGS->Debug->Any architecture |Any SDK = "-ObjC -all_load"
Any ideas or suggestions what else should I try?
This problem appears to happen when creating new projects with Xcode 4.2. When creating such projects, Xcode adds one hidden key in app plist file, that restricts device to run on armv7 architecture only. You need to delete that key. Also, you need to replace "standard (armv7)" to "armv6 armvv7" value in ARCHS build setting, both in project and targets build settings. And also to check ONLY_ACTIVE_ARCH is set to NO.
I have seen 'finished running...' in my code too with an iPhone 4. Whenever that happens, I do a clean build and also uninstall the app from my iPhone. Post that, things start working again.
Is it possible to invoke iPhone Simulator and launch app through UIAutomation? If so, is it possible to invoke UIAutomation script through shell script or Java?
Or can I able to do this through applescript? Thanks
Xcode is Applescriptable. Thus you can run a shell script that runs a compiled AppleScript that runs Xcode and tells it to build and run an iOS app with the Simulator selected, which should start the Simulator and launch the app in the Simulator, if there are no build errors, etc.
Yes. We use Java to launch Instruments, run ApplesScript that will load a TraceTemplate for the specific Application\Device\Simulator, and then AppleScript to run (Record) a specified JavaScript.
We have implemented a very robust automation framework for testing iOS apps with entirely "dynamic" test scripting. It does not require jailbreaking the device, and it does not require linking any automation support libraries into the application being tested.
SAFSDEV on SourceForge!
This opensource project has working code which also serves as great examples of the Java, AppleScript, and JavaScript required to do these types of things. It is currently coded to support both iOS 4.3.3 and iOS 5.
Hey it is possible to do that, using below commands
1.Build using the below command
xcodebuild -project myApps.xcodeproj -scheme myApps -configuration Debug -sdk iphonesimulator5.0 clean build
To run UIAtomation scripts
instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate /Users/sougata/Library/Application\ Support/iPhone\ Simulator/5.0/Applications/22667B7D-B4AF-4134-8C9A-44EEB60304A9/myApps.app/ -e UIASCRIPT Regression.js -e UIARESULTSPATH ~/myreport
I'm trying to implement the Cocoa plotting framework (Alpha Release 0.1) in my iPhone app.
I figured I'd first try to run the sample they provide. I attempted to open and compile the project located in /Source/examples/CPTestApp-iPhone/.
It says my base SDK was missing right off of the bat, so I edited the Project settings and the Active Target to use the iOS4 SDK, which I've done before for samples and had work. I'm not sure what to do. I'm running one of the newest Unibody Macbooks, with 10.6.4.
Here is the full error:
// - start - //
Check dependencies
[BEROR]No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=i386, VALID_ARCHS=armv6 armv7).
// - end - //
Thoughts?
I also went to the Build settings for the target(s) that failed and added "i386" to the valid architectures
Try this:
Project Build Settings:
Architectures: Standard (armv6 armv7)
Base SDK: Latest iOS Build Active
Architectures Only: Checked Valid
Architectures: armv6 armv7
Delete any sub settings in the Architecture build setting.
Target Build Settings:
Same at project settings.
Frameworks
Add the SystemConfiguration.framework to your project. - Not sure why this had any impact.
Clean all targets.
Build for the simulator.
The long explanation for this can be found on our blog: http://longweekendmobile.com/2010/06/15/fixing-the-missing-required-architecture-arm-in-file-when-developing-for-ipad/
Adding i386 to the Valid Architectures list worked for me!
For me it was that I had to add i386 to the VALID_ARCHS list. Odd, but it fixed my problem for simulator builds.
See this post.
You have selected as active architecture "active arch=i386 (your Mac)" but the project compiles for " VALID_ARCHS=armv6 armv7 (iPhone Device)", try setting the right arch in the project settings, so it is built for iPhone as it should be.
This project appears to pre-date iOS 4, so you need to open up the .xcodeproj file for the Core Plot library itself, too. It probably also has a broken reference to an old iOS Base SDK and may need the architectures updated.
This happens all the time with old projects migrated to SDK 3.2/4.0. You have to open the target settings and change everything to SDK 4.0 or 3.2. You can still have the target OS be 3.0 if you want that. If it still says "missing SDK" you neglected to change one of those settings to 4.0 or 3.2.
armv6 armv7 , Works for me in valid Architecture .
If you tried all method with "NO SUCCESS"
Try to run project on you device, if it works on device then it will works fine on simulator too.
I'm using google unit testing code.
I'm building it quite nicely with xcodebuild on the command line. Now I want to run it (preferably on attached Device but simulator would also work) and catch all the feedback from the tests.
But I can't find out how to run it. Any ideas?
Jeff Haynie's iphonesim project on Github looks like it could work. I had trouble building 27812bb4b (make failed on a warning in nsprintf.m), but that may just be me using a pre-release OS and SDK. See also this related question.
If you followed the instructions from the Google page (creating the target, adding the test files to the target) and you have an iPhone SDK certificate (you need it to upload apps to the device) you can just change the Active SDK to your device (upper left corner combo in XCode)
If you don't have a certificate, you need to apply to the SDK program.
The only iPhone simulator and debugger I'm aware of comes with the iPhone SDK. In order to use the iPhone SDK you need to have an Intel-based mac with OS 10.5 Leopard installed, in which case you might as well be programming/compiling in XCode instead of using the command line.
There has to be some misunderstanding here. What exactly do you want to run from the command line? The test suite? If so, the test suite should be a separate target, so that all you have to do is build it, for example like this:
xcodebuild -target UnitTests -sdk iphonesimulator2.2.1 -configuration Debug
If you have the testing target configured correctly, it will run the RunIPhoneUnitTest.sh shipped with the Google Toolbox and the script will run all your tests.