App won't install on iPhone after running with Xcode

Hey all! I recently ran into an issue where I can run my project on my iPhone from Xcode but as soon as I stop it on Xcode I can no longer launch my app from my phone.

I have always been able to build and run to test my project on my iPhone then it is permanently installed and can run independently from Xcode but now it seems I can’t. Is anyone else having this issue?


Hi Matt,

Hmm, I have not experienced that.

Do you have a development certificate installed in Xcode?

Chris has a really good post on his site describing the process of installing apps on your own device. This may be helpful sniffing out the problem.


Hey there Mark,

Thanks for responding and Happy New Year!

I do have a certificate and have deployed my app to test flight for multiple internal testing iterations.

This happened right after adding an additional scheme (staging and production) with environmental variables to hold the appropriate api keys and other ‘secret’ variables depending on what build I was running while keeping those keys out of my source code. After doing research this seems the best way to keep your keys secret. However after hours of thinking I messed up my project by adding another scheme, it seems these environmental variable only work when running the app while connect to Xcode. So every time I try to run the app without Xcode, it crashes because these env var’s return nil.

Bummer! Rookie mistake navigating for the best solution… Any chance you have a good resource on how to store api keys and keep them out of your source code? I have seen adding them to additional plists with config files and adding them to gitignore… is that my best bet? It is even worth it?

Thanks again Mark!

  • Matt

Hi Matt,

It never dawned on my to store API keys anywhere except in the source code where they are needed. I am guessing this is to avoid someone reverse engineering your app to get at them?

An interesting puzzle. I would suggest my favorite database that Chris in his course introduced me to: This is a great local database. You just need to make a call to the database when the app needs an API key.

Here is a link that describes the encryption:


Hi Mark,

That is correct that I want to protect them from reverse engineering or someone getting ahold of the source code. Not quite necessary at the moment but wanted to be proactive and learn about it now if I could.

I will definitely check out and give it a shot. Thank you so much for your suggestion and time! Have a great weekend.

All the best,