ios how to launch app on device using command line - ios

I am doing ci stuff now. Everything works well, I can package and install ipa on device.
But I don't know how to launch the app. I search Google million times to see whether there is
some methods to do it. Unfortunately, I can't solve the problem now.
Any points. Thanks in advance.

There are a number of tools available for this now. Your mileage may vary.
https://github.com/phonegap/ios-deploy
https://github.com/libimobiledevice/libimobiledevice
https://github.com/robovm/robovm
You can also try using the Instruments command line tool for launching apps (for example, if you need to run UI Automation).

As Aaron points out RoboVM can do this using its wrappers around libimobiledevice. These can be used standalone. Just download the latest jar file from http://repo1.maven.org/maven2/org/robovm/robovm-libimobiledevice/0.0.7/ and call it like this:
java -cp robovm-libimobiledevice-0.0.7.jar org.robovm.libimobiledevice.util.AppLauncher
This will print out some help on how to use this tool.

Plug in your iOS device, put it in provisioning portal, click run on Xcode. Make sure your device is displayed on the right of the run button.
Xcode 5 should enable you to do this all from the app.

Related

App do not run on second Simulator?

I am trying to run a app on multiple simulators. I did manage to run 2 simulators see link Xcode6: Run two instances of the simulator.
I can run other apps on the two simulators. I did manage to run this app on the two simulators in the past.
For some reason when I try to run a second simulator there is a pause I can see IOS system log trying to open the it just closes.
I searched the IOS Log file found that both simulators have the same data (unhelpfull). I would appreciate it if someone can just point me in a direction where to start searching for the problem?
My Mac memory is fine do not have to few. The start file is also not have anything I can see that might cause this problem.
Thanks in advance.
My problem was localisation that is why the add did not run on default english setting. The add worked correctly throw Xcode because the Sceme helped set the language.

App installation failed: Could not write to the device

In Xcode 6.3, I got this error when trying to run an iOS project written in Swift on a real device.
App installation failed
could not write to the device.
I tried to clean the project and run again, but the same error occurs.
How can I fix this error?
Deleting the app on the device and running the project again works for me.
I did a Clean and installed my app successfully.
Product->Clean(Shift-Cmd-K)
I turned off the device and turned it on again after which I did not get such error.
OK, few things you should consider that could guide us to the problem, please check and post the answers:
is your project using capabilities? are they set correctly (should be all green)
did you try with a different project (something really simple)?
are you able to install apps from the App Store?
did you check the amount of free space left in the device?
if not, another suggestion will be using exception breakpoint, there is someone that posted an explanation how to setup it, do it and post the logs
App installation failed
I hope it helps you
Got this problem twice in one week on complete different devices.
One device had no more storage left, after deleting some apps the project installed perfectly.
The other device was fixed after rebooting the device
If you are using a free developer account you may need to uninstall some other apps you have signed.
For me it was the provisioning profile - I used distribution instead of development
My issue was an embedded framework.
Go to "Build Phases" -> "Embed Frameworks" -> Check "Copy only when installing", and it got rid of the issue for me.
For me the following did not work on iOS 11 beta 10, XCode 9 beta 6:
Restart the device
Deleting the app from the device
No symlinks were in the project
There was plenty of storage available
Deleted Derived Data and voilá, it worked again
in my project this problem happened because there was a folder with symbolic link. I removed that folder and it worked properly.
This error has many potential root causes, as can be seen by the large variety of suggested answers. The best approach to troubleshooting app installation issues like this one is usually to inspect the console of the iOS device itself, as that'll often provide much more specific error messages. In Xcode open the 'Devices and Simulators' window and take a peek at the logs of the device where your app is being installed.
In my case, the "Could not write to the device" error was being caused by this:
Feb 27 10:54:58 iPhone-7-110 installd(MobileSystemServices)[46] : 0x16f92f000 -[MIBundle _validateWithError:]: 38: Failed to load Info.plist from bundle at path /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.ebmR6U/extracted/SampleApp.app/Frameworks/SomeFramework.framework
Which clearly hints at what's actually going on. I had forgotten to set an Info.plist file for my dynamic framework target (used by the app).
I had a symlink in my project to a file outside of the project. When I deleted this symlink the install worked fine.
I was having the same error, i just deleted the project and fixed!
Go to Window -> Project and right click, and remove from projects!
In the case of your device have an app with the same bundle identifier, Xcode will throw this error.
Try to delete potential app with the same bundle identifier.
Check your provision profile, maybe you are using the app store provision profile like me. I had to change the app store provision profile to development, now it's working.
Tried all of the above answers: Deleting the app, clearing storage space, cleaning the project...
What finally worked was bumping the build number in info.plist (General > Build)
For anyone still facing this Issue:
There are so many reasons and this is one of them as it happened to me.
I've faced the same problem and I was connected wirelessly and If you are trying to install the application in wireless connecting mode (connected through same network), this might probably because of poor internet connection. Check your internet connection and try again, it works fine...
Get rid of embedded libraries, dont' just throw it in there make sure it is embedded indeed.
If you use your iPhone for debug, maybe, because your iPhone's storage space is less than your debug App.
Clean your iPhone --- Real machine
Clean your Mac --- Simulator
This looks like another time waster courtesy of Apple's amazingly high class development team. On iOS11 Xcode9 (pick your beta, any one works) this will happen randomly. Appears to be more frequent if you dare to switch apps while compiling. Just build again and stare at xcode - it'll work the second time without fail in my experience.
Apparently this message can also appear if the system clock of device where the app is being installed is too far away from the current time.
I was doing some tests with date formatters by changing my iPhone's system clock and eventually forgot to reset it to the current time. Afterwards it always displayed the same message ("could not write to the device.") whenever I attempted to run the app. Simply resetting the clock in Settings fixed the issue.
Nothing helped me. I followed the below steps,
Clean derived data folder
Quit Xcode and disconnect device
Restart Macbook
Restart Device
Open Xcode
Clean and run the project
Finally I got it working!!
I am facing same issue then solved out follow this step and now its working.
Deleting the app from the device
Try to install another application
Remove derived data in X-code.
Restart X-Code then clean and build the project then run.
It's still not working then
Remove un-used application
Restart the device and check the Available and capacity in settings
Again app run in device
I hope its worked, enjoy it.
My problem was I had initially installed the app using a different set of developer credentials on the device. Deleting the app from the device fixed it.
Maybe it can be due to the following error App installation failed. No code signature found. In my case after a project clean the description of the error switched to "No code signature found".
In my case I created two frameworks but they had the same bundle identifier.
This caused the installation to fail, so double check the frameworks bundle identifiers and make sure that each of them have a unique bundle identifier.
Environment: Xcode 10
sometime this error occurs due to wrong certificate.Please make sure your certificate.
Also this the error shown if your machine running Xcode is low on space.
Once I had to load an App Container for debugging purposes into an iPad, said operation failed because the container was too big (18 GB) for this device (16 GB minus the OS), so that I desisted the task and completly forgot about it, leaving the failed installation in the device. Later, when trying to install a different application this error appeared, once I got rid of the failed app installation, everything got back to normal.
Basically, your Ipad might be low in storage.
One reason this can happen is if your app bundle contains broken symlinks.

Xcode blocked at “Attaching to (app name)” when I launch my app in the simulator

I know there's a lot of posts with the same that problem. I just spent at least 2 hours to read them and I tried everything I saw in the responses but it still doesn't work. I don't know what to do anymore. Can someone help me?
I use Xcode 4.2.1
This problem occurs regularly for me, and the solution was always to kill the process named SimulatorBridge.
And to simplify the solution you can add a custom 'behavior' in Xcode to do the task by following these steps:
Make a shell script file with this command:
#!/bin/sh
killall SimulatorBridge
Save it in ~/Library/Developer/Xcode/UserData/Behaviors/ as KillSimulatorBridge.sh.
Open Xcode > Preferences > Behaviors, and add a new behavior to run the shell script:
Now, you can run this behavior whenever Xcode hangs while trying to attach to your app, and you can even have a keyboard shortcut to run it.
Hope this helps someone.
It can also happen when a different user account has the simulator running on the same computer. In that case, close the simulator on the other user's account and try again.
Restart your computer.
The simulator sometimes gets stuck and this is the only way I know to reset it. The same thing can happen to the device as well and you just have to switch it off and on again.
If that doesn't work, you may have to reinstall the SDK.

how to Run two BlackBerry simulators in windows eclipse?

How to Run two instance of BlackBerry simulator in windows eclipse?
The documentation regarding developing with BlackBerry Messenger indicates that you can run two simulators at once, at least with the simulators that come bundled with the BBM SDK.
You cannot. If you try, you will get an error message saying only one simulator can run at a time.
What you need to do is:
Install the blackberry eclipse plugins twice and make two
workspace of each eclipse.
Run the two simulators in each eclipse and error like "could not
open port 19780 and it is use by another program....." will pop
out in one of your simulator.
So made the changes in pin,
data-port values in .bat files, rimpublic.property files inside
MDS and fledge-settings.conf in one of your simulator... but this
changes will not be reflected on your eclipse.
So what you need to do is, when you click the debug configuration from your
eclipse, you will see the simulator option there. So, click the simulator and change the PIN value, whatever you have made the changes in .bat files.. and just after that in the simulator you will again find the option of network, there unselect the disable registration button...once all this changes is made click apply and restart your eclipse... this will surely solved your problem

Install iOS app into xcode simulator?

We're iOS (and other mobile platform) developers and our sales folks routinely need to provide demos of our apps for clients. What we're trying to do is automate a process so sales people can go to a self-serve website and feed the app into their simulator.
Using xcodebuild we can kick off the build process and then present it as a secure download link (via our intranet) but all that lets them do is install it to their iOS device. This is OK except not everyone on the road has an iOS device (or some have old iPod touches, and that's super slow). So, I was thinking that there's gotta be a way to get it installed in their simulator.
I see that others have hacked it in there by zipping up a simulator directory and placing it on another:
http://discussions.apple.com/thread.jspa?messageID=7680994
Set target to simulator, release.
deploy. stop iphone simulator. zip
your app from ~/Library/Application
Support/iPhone
Simulator/User/Applications/ send it
to someone else, and let that person
know to unzip it in that folder, than
start iphone simulator - and you're
done.
I guess we can do this, but it doesn't seem deterministic (or at least, a lot harder to script). I'd prefer to work with the .app but if the only way to do it is with this hacky copy and paste operation, that'll be what we have to do.
Any thoughts?
This could work: https://github.com/landonf/simlaunch/
I have not tried it yet by myself, but from video looks like the application converts .app compiled for simulator to a launcher, which can be used to run the app in simulator without installing it through xcode.
It probably uses the same kind of approach for simulating the app without installing it first that is described here: How to install iPhone application in iPhone Simulator
I know this isn't a direct answer to your question, but have you thought about having a server (eg a Mac mini) that has all the installed software on it? Then they could just use some form of screen sharing to run the app remotely.
I've used the simulator build mechanism above with a number of clients and once they figure out the right folder to drop the actual folder into, it's gone very well.
It's a little bit of a hack as you say but in some cases it also beats having to deal with ad hoc provisioning etc when it's less important to have it on an actual device itself.
I haven't tried it yet but I've heard pretty good things about Test Flight (http://testflightapp.com/) also as a way to distribute demos/betas so that might be worth a look as well.
I just developed a pair of scripts to (a) extract an app from a iOS simulator, and (b) install it on another iOS simulator. https://github.com/christopher-prince/SimAppScripts
Locate the .app bundle in your built products directory, typically under Debug-iphonesimulator or Release-iphonesimulator. Drag and drop that bundle onto the Simulator window and it will be installed (you may need to swipe on the home screen to show the icon).
You can also script this from the command line using xcrun simctl install. The xcrun simctl launch command can also start the application.
Most build systems can be automated (or you can use a post-build script from within Xcode, ordered as the last step) to create a ZIP of the app bundle and put it somewhere for download.
(If having the Archive workflow support creating Simulator IPAs would be useful for you please file an enhancement request at https://bugreport.apple.com)
check out waxsim:
https://github.com/square/WaxSim
http://cocoamanifest.net/articles/2011/12/running-your-ios-app-in-the-simulator-from-the-command-line.html
If you build it for i386 and distribute the .app, I believe this will work.

Resources