Unable to deploy Ionic 4 to iOS device

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

1 Like

ionic cordova run ios -l --address=0.0.0.0

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

1 Like

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


Let me know if this helped to solve your issue!
1 Like

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 subprocess cordova .
cordova build ios --release exited with exit code 1.
What was the issue you had with Cordova?

That’s odd. I can find the DevApp in my AppStore?

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)

At this point I’ve been trying everything online:

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.

A suggestion was to run this:

sudo ionic cordova build ios --device --aot --release --prod --minifycss --minifyjs --optimizejs --verbose – --buildFlag="-UseModernBuildSystem=0"

I got the following error:

CordovaError: Promise rejected with non-error: 'Error code 65 for command: xcodebuild with args: -xcconfig,/Users/anonymous/Development/appName/platforms/ios/cordova/build-release.xcconfig,-workspace,AppName.xcworkspace,-scheme,App Name,-configuration,Release,-destination,generic/platform=iOS,-archivePath,App Name.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Users/anonymous/Development/AppName/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/anonymous/Development/AppName/platforms/ios/build/sharedpch,-UseModernBuildSystem=0'
at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:29:15)
at process._tickCallback (internal/process/next_tick.js:68:7)
[ERROR] An error occurred while running subprocess cordova.
cordova build ios --release --device --verbose --buildFlag=-UseModernBuildSystem... exited with exit code 1.

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.