Installing built iOS App in simulator from terminal? - ios

We build an app through the terminal with xcodebuild and also want to install it in the simulator using the terminal. Any advice on this? Seems tricky.

(Any reason you're just not using the default xcode way?)
Heavy mate. I would bet there's an easy way to do it (I'd imagine)
You could make a simple ssh client in Objective-C and run it on the simulator then simply copy the necessary files with said program. Since it's not going through Apple, you'll probably have a pretty easy time with it.
Oh and it went unanswered here

The forum thread, http://forums.macrumors.com/showthread.php?t=547557, seems to have advice which works:
Look inside your ~/Library/Application
Support/iPhone
Simulator/User/Applications/ directory
and see what happens inside this
directory when you install and run
apps using XCode, and also when you
delete apps using the Simulator.
You can run the Simulator by itself
(without starting XCode).
If you start the Simulator, delete an
app, quit the Simulator, put back
copies of the files that were deleted
from the support directory, and
restart the Simulator, the app will
reappear in the Simulator.

Related

Xcode 14 Beta - Build Issues with LLDB

I am having issues when building any app with an iPhone 11 Pro or iPad Pro as the physical device destination. A new instance of a standard template app with Hello World takes moments to build and install on the phone, but then the app freezes on a black screen. Console reports the following.
warning: libobjc.A.dylib is being read from process memory. This indicates that LLDB could not find the on-disk shared cache for this device. This will likely reduce debugging performance.
Interestingly, if I stop the build in Xcode, which quits the app on the device, then manually launch the app on the device, everything works as expected but no logging of course. Reverting back to Xcode 13.4, the same issue occurs suggesting its an iOS 16 beta issue?
Further testing suggests this is an issue with the debugger. If I allow Xcode to build and run an app to one of my devices, it will launch and then freeze on a black screen. After a few minutes the app progresses to its main ContentView and the console appears to then function as normal.
Any thoughts? Thanks.
To those who bump into this later (or future-me) - I had the same issue.
Entirely removing the Device Support folder and re-opening Xcode forces it to recreate the device support files.
tl;dr
rm -r ~/Library/Developer/Xcode/iOS\ DeviceSupport
And then re-open Xcode.
More context:
lldb uses the gdb-remote protocol for reading memory from a device. This has the benefit of being a widely supported protocol, but it is not blazingly fast. So lldb will work much better if it has copies of the binaries that get loaded into your program on the local host where it can inspect them directly.
Xcode is the one that makes that happen. When you plug in a device and start up Xcode, if the OS is one Xcode hasn't seen before, it copies the system binaries over in one gulp and puts them in ~/Library/Developer/Xcode/{DeviceType} DeviceSupport/SystemVersion. If this process fails for some reason, then lldb will have to fall back to reading symbol information from the device, which is slow - that's what the warning is warning about.
If you delete the current version of the DeviceSupport directory, the next time you try to debug, Xcode will copy the binaries over again. If the error you had was transitory, then that should fix the problem. If not, it would be good to file a report with Apple Feedback to figure out what's actually going wrong.
Just open Xcode, it will ask you to install some required additional components. That's it.
It happens after updating Xcode or Mac OS.
Updating xcode then reopening it did it for me.
Merging the current top-voted answer and the steps in the other question's solution worked for me only:
rm -r ~/Library/Developer/Xcode/iOS\ DeviceSupport
Open the Xcode project/workspace with your device connected
Wait until the “Fetching debug symbols” process finished
Close the Xcode
Reopen the Xcode again and try to Build and Run on your device
You are using Connect via Network. Uncheck it and use a Cable. Looks like some recent Issue in iOS 16
I had this issue while using flutter and iPhone. I fixed it by just running flutter clean and then flutter pub get in the terminal and worked. Incase any are having the issue while using flutter.
If you are using 2 xcode apps try deleting 1 old one might fix it

Xcode 8 App installation failed, unknown error occured

The following error occurred when I tried to run a project on my iOS device. Running it on a simulator works fine.
The other weird thing is that I am able to run my other projects on my device, only this particular project that is giving me this error.
I tried all the solutions I'm able to find:
Cleaning the project, deleting derived data
Restarting Xcode, my Mac, and my iOS device
Deselect 'Automatically manage signing' in the testing Target.
I couldn't delete the app from my device and re-install it because it wasn't installed on my device before.
Any help would mean alot to me! I am using Xcode 8.1 with Swift 3.0, running on a iOS 10.1.1 device.
Close your Xcode completely from currently running on Dock
Unplug your iDevices cable at your Mac and plug again.
Open Xcode Again.
Clean,Build and Wait for indexing the device
Delete the previous app you install on your iDevice
Then install
If you have free Developer ID, make sure you got the Internet access
right on your iDevices.
Else,
Check your provision profile or certificates of your app that it's still available or not [Expire or not].
If expired, please create again.
Install those latest provision profile at your Xcode Preferences/Account/Detail/
Make sure Signing "Debug" and "Release" aren't empty
Close the Xcode(Completely quit from Dock) after you completed those steps
Open the Xcode again and do Clean,Build and Install
Hope this help.
Other alternative way,
Remove the app on the device and re-install
Change build version no and install again
Clean your the project and reattach your device
Do a pod update if you are using CocoaPods. This error can occur due to one of the pod libraries, device logs can be checked for the name of the library.
I get this error only on the second compile for device targets, and I've found that if I just modify one critical source code file by adding just an empty line, the error goes away and Xcode will compile again. The other way is to target a second device which isn't always convenient.
A way around this confusion is to add a an Xcode Run Script that basically does this for you.
Force Xcode 9 to recompile after a build seems to be file dependent also
touch ${SRCROOT}/MyProject/MySourceFile.swift exit $?
With the above script my issues went away, and I never saw the Xcode Alert again. This bug has been in several iterations of Xcode now.
I have the same problem too, and also tried all the solution like you. unfortunately, not solve this problem, but I copied my project to another path, the copied one can build on my phone successfully, hope this can help you.
It can happen if you have debugged the same app(bundle identifier) with more than one Apple Ids. Remove all accounts from Xcode and sign in to the one which you're currently working with.
Restart your Xcode & Uninstall your app.
Build & Clean your Project, now it working good.
this works for me
above is not working please Restart your system
This error message occurred when I was building on an iPhone 5 and an iPhone 6 Plus with Xcode 10. Build in iPhone 5s Simulator gave a different error: "App could not be installed at this time…/Notification Extension: No such file or directory"
Problem was resolved by check marking Target Membership in my Notification Extension's source file.

Xcode - Can't run app on simulators, or on phone

I was trying to run my project on Xcode, but I found that when I hit Command-R, Xcode would say the app had built, and was running, but after 3 minutes, it still hadn't appeared on the simulator. I ran it again, and it did the same thing, so I force-quit Xcode, and reloaded it. When I had reloaded Xcode, all the simulators had disappeared, and when I try to run the app on my phone, Xcode starts building, and then just stalls when processing one of the XIB files.
I have tried going to Windows->Devices to reinstall a simulator, but Xcode just freezes when I do this.
It seems I have royally screwed my developer environment by force-quitting while it was building. How can I fix this?
All help app-reciated.
Try to exit the simulator.
If this doesn't work try to restart the computer.
if none of them work you are screwed and should reinstall xcode
I fixes this by downloading the Xcode 7.2 beta. If you're viewing this question at a later date, download the newest beta of Xcode (or if you're using the beta, download the standard code). This version of Xcode is completely separate to the standard Xcode, allowing everything to run on normal settings.
First try and restart Xcode, then your computer. If this does not work, reinstall the newest version of Xcode from https://developer.apple.com/xcode/

Calabash iOS cal app showing up blank when Running Cucumber

I followed the steps to set up Calabash-iOS as specified in their README: https://github.com/calabash/calabash-ios (the fast way). When I run the -cal target by clicking the standard Play button in XCode, everything is working great.
However, when I run the cucumber command from my Terminal, it opens up a blank app with just a white screen and none of the view components. Any ideas on how I would debug this?
Using XCode 5.1.1, Calabash iOS 0.9.168, Simulator 7.1 (4-inch and 4-inch 64-bit)
Still not sure what caused this. I got my co-worker to install Calabash on his machine, and it worked. I deleted my code, cloned it again, re-installed it, and it still had the same problem. I re-downloaded again and put it into a different directory path (another folder), and it works!
I was having a similar issue, where I would make changes to the app and when running 'cucumber' it would not pick up my new changes. I believe what help me resolve the issue was to reset the simulator and its contents, exit out of any simulators already running, and make sure I am not running the interactive calabash-ios console. Hopefully this helps, and if I find a better solution I will let you all know!
You should delete application from Simulator (check what simulator was used in calabash build) and re-install it again. You can use Xcode for this or just re-run it from terminal. It should work then.
No needs to reinstall calabash or other packages.

iOS - app works on device but not on simulator (anymore)

I know already that there are topics like that, but nothing helped in my case ...
Here the info:
The app worked both on simulator and device the whole time.
I renamed the project recently into another name. Still worked both fine.
Today I realized that it didn't change the folder name and then it couldn't run anymore because it had somewhere the location saved from before. Then I gave the folder the old name again and it could build and run it on the device again. But weirdly enough it doesn't run on the simulator anymore.
Funny thing is also that it said that the profiles were expiring, which weren't even related to that project so I deleted them. No errors, nothing. It just builds and directly finishes on the simulator.
The app is build for iOS6 and doesn't support earlier versions. So it can't be the armv6 armv7 architecture problem ...
What I also tried is the following: I zip every bigger version change and save it on an external HD (in case anything dies) and also have it uploaded at bitbucket. I reset my project to those old working versions and it neither ran on the Simulator.
Thanks in advance for further tips!
I guess the problem should be in your simulator but not necessarily in your app. Please have a try to:
reset the simulator and retry
if it still doesn't work, remove the app on simulator and re-install it via Xcode debugging

Resources