So far I’ve followed all of the online tutorials to deploy an Ionic 4 app to an iOS device. I went through the code signing process and used the latest version of xCode to attempt to deploy my app to an iOS device. According to xCode the deployment succeeds successfully, the icon appears on the device but when attempting to open and run it there’s just a blank screen…the app never opens even though xCode displays a successful deployment. I can deploy to Android successfully and run the app but not with iOS. I’m not getting any errors, it just opens to a blank screen.
Any help would be greatly appreciated.
Thank you
Yes, I have a profile provisioned with a dev team email address.
make sure the device is connected to the same network as the system is…
if you don’t want the live reload functionality, use this
ionic cordova run ios
Ref https://ionicframework.com/docs/building/ios
If you’re attempting to build an Ionic 4 application to Xcode, you’ll need to run ionic cordova build ios. After this, you can access your build in the new platforms folder it generates.
If you’ve already done this and still get to a blank screen on iOS when you launch the app, there is a bug in your code preventing it from displaying. I’ve had this issue before and the best advice I can give is to figure out exactly what code is running when the app launches. In my case, I had a Cordova plugin bug that was impossible to test on a web browser because it doesn’t support Cordova. (So the app was running fine on browser but when downloaded to mobile, it broke)
One potential way to save time debugging (which I didn’t figure out until after the bug was fixed) would be to use Ionic’s free DevApp. You can download this app in the iOS AppStore here
In the DevApp tutorial, it’ll tell you to run your application on the desktop with the command: ionic serve -c
This used to work, but in recent Ionic CLI updates it has changed to ionic serve --devapp
Thanks for the suggestion. I was able to successfully run ionic cordova build ios from the CLI. I accessed the platforms folder and performed the signing in xCode. I’ll try downloading the devapp to see if that helps me debug. But question…I assume I can inspect the devapp the same way I would in a browser and it provides console logs?
Unfortunately you cannot inspect in the DevApp. That is the only major drawback of not repeatedly building the project to your device. Instead, you’ll be able to make small edits to your code and instantly see if it made a difference in allowing the application to run.
Believe me, I totally wish we were able to inspect.
Unfortunately Ionic DevApp isn’t available in the app store but I think I may have a Cordova bug as well.
When I run sudo ionic cordova build ios -prod --release
[ ERROR ] An error occurred while running subprocesscordova.
cordova build ios --release exited with exit code 1.
What was the issue you had with Cordova?
When I run the command, I don’t use the tags -prod and --release; perhaps that could be a problem? I literally only run ionic cordova build ios without sudo on my Mac as it isn’t needed for me.
Also, it may help if you tried running ionic cordova prepare ios before you build it.
The issue I had was just a user error with a Cordova plugin (specifically the SecureStorage plugin)
No luck…still just opens up to blank screen on an ios device. Tried the above suggestion as well as the following:
sudo ionic cordova build ios - --buildFlag="-UseModernBuildSystem=0"
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo ionic cordova prepare ios
No idea what the problem is but I think it’s probably an issue with Cordova, I’m just not able to find anymore information.
Sorry for my late response. I did find that the ionic CLI was not functioning properly on my Mac when I attempted to build the application straight from terminal, so instead I just ran ionic cordova build ios and opened the generated Xcode project inside of Xcode manually. This way, I could adjust minor settings like disabling the Modern Build System editing the code signing account.