APP only works the first time on ios - ios

im having a problem since I’m trying to test my app on iOS.
The first time I install my app on an emulator/device the app works correctly. But if I close my app, and open again the app don’t work anymore and get stuck on the white screen forever.
My ionic info is:
cli packages: (/usr/local/lib/node_modules)
#ionic/cli-utils : 1.14.0
ionic (Ionic CLI) : 3.14.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
#ionic/app-scripts : 3.0.1
Cordova Platforms : ios 4.5.2
Ionic Framework : ionic-angular 3.7.1
System:
Node : v8.7.0
npm : 5.4.2
OS : macOS Sierra
Xcode : Xcode 9.0 Build version 9A235
Misc:
backend : pro
I tried so many solutions, like remove and add de platforms, remove and add de plugin one by one. The app works on Android perfectly, but on iOS I have this problem.
Can someone help me?

We can debug ios application
ionic emulate ios -lc
Which runs app using simulator and outputs console logs and errors to terminal with live reloading.
There are three primary options.
Debug using Safari. This is good for debugging a hybrid app, but
cannot tell you output related to native plugins.
http://webdesign.tutsplus.com/articles/quick-tip-using-web-inspector-to-debug-mobile-safari--webdesign-8787
Open the project and build to device in Xcode. This shows the output of the entire device http://cordova.apache.org/docs/en/3.5.0/guide_platforms_ios_index.md.html#iOS%20Platform%20Guide
Debug with Ionic CLI. Using ionic run ios -l -c -s with the flags will use live reload and print the logs to the console. http://ionicframework.com/blog/live-reload-all-things-ionic-cli/
From: Debug Ionic app on IOS?

Related

Ionic 3 build with --minifyjs flag get stucks on first load of app only in iOS

I have an Ionic 3 app that runs well in Android and iOS without the --prod flag. Now I want to test the App in production mode in iOS and Android.
When I try to run it on Android everything works great! and a little bit faster and smoother. Now I try to run it on iOS which it doesn't work. It gets stuck on the first load of the App on the Splashscreen. At first I expect that there is something wrong in my plugins or versions compatibility of my plugins and to the version of the iOS device.
But I was wrong I try to run it without the --uglifyjs, --minifycss, -aot, --optimizejs and it works, the app didn't get stuck at the first booth or first load. All these flags are part of the --prod flag right? But you notice that I didn't include --minifyjs in the flag. Because when I try to run it on --minifyjs the problem occurs again when it got stucks on the first load of the app.
I have also reference to my old question: Ionic cordova run ios --prod gets stuck on splash screen loader but that wasn't the problem anymore. It only happens when I try to use the --minifyjs flag.
Here is my ionic info:
cli packages: (/usr/local/lib/node_modules)
#ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
#ionic/app-scripts : 3.2.0
Cordova Platforms : ios 4.5.5
Ionic Framework : ionic-angular 3.9.2
System:
ios-deploy : 1.9.2
Node : v8.9.3
npm : 5.5.1
OS : macOS High Sierra
Xcode : Xcode 10.0 Build version 10A255
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro
So what can be the problem with that? I think it is more of a compiling issue of minifying js files by angular and ionic by reducing its size. I think it affects some of the js files that caused the problem.
Appreciate if someone could help. Thanks in advance.

integrating OneSignal into Ionic 3 causes problem on iOS device

I have an ionic application which works fine both on android and iOS, in simulator and in real devices.
I have integrated the OneSignal API to add notifications to my application.
On android everything works fine, but the problem shows up when running on an iOS device.
These are the steps I use to run the project on iOS:
- Add the iOS platform with the command ionic cordova platform add ios
- Build the ionic app source to generate the Xcode project with the command ionic cordova build ios --prod or ionic cordova build ios
- Open generated project in Xcode
- Assign the team to the project
- Add push notification to project from the tab 'capabilities'
- Add remote notification to background mode
- Generate the .cer and .p12 certifications
- Add them to The OneSignal project on the OneSignal dashboard
- Run the project
After that when I build the app from Xcode to the iOS device (connected to my mac via a cable), the notification permission popup appears, I accept it and the notifications comes when I send them from the OneSignal dashboard.
But when I try running the app again (with the iOS device not connected to the mac) it does not work, the splash screen keeps loading infinitely.
I noticed another thing that when building with --prod flag the app does not work neither when connected to the mac or not. But without that flag, it works only when running it from Xcode as I said before.
I am almost certain that's due to the OneSignal API since without it, everything works fine when connected to the mac or not.
OneSignal version: ^2.4.2
iOS version: 10.3.3
Ionic info:
Ionic:
ionic (Ionic CLI) : 4.0.6 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.1.9
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : ios 4.5.5
System:
ios-deploy : 2.0.0
NodeJS : v8.10.0 (/usr/local/bin/node)
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.3 Build version 9E145
Environment:
ANDROID_HOME : not set

Ionic 3 IOS App does not work for first launch, but works after force kill and launch

I am building an IOS app using IONIC.
When I first launch the App in simulator or real device, the app is stuck on splash screen. Platform ready event is never getting called and thus splashscreen is never hidden. But it works fine after I kill the app and launch again. No idea which direction should I look in. Here is my ionic info
#ionic/cli-utils : 2.0.0-rc.6
ionic (Ionic CLI) : 4.0.0-rc.6
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
#ionic/app-scripts : 3.1.9
Cordova Platforms : android 7.0.0 ios 4.5.4
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
ios-deploy : 1.9.2
NodeJS : v8.9.1
npm : 6.0.0
OS : macOS High Sierra
Xcode : Xcode 9.4 Build version 9F1027a
Environment Variables:
ANDROID_HOME : /Users/ashfaq/Library/Android/sdk/
please try this :
In xCode File > Workspace Settings > Build System : Legacy Build System
In Signing Team, be sur to use Team and provisioning Profile with developer capability (Debug) and not for production (Realse)

iOS don't killing correctly app - Ionic

When you leave the application approximately 3 or more hours in iOS in the background, it does not kill the application correctly, this causes index.html to be blank in the safari development console.
engine name="ios" spec="4.4.0"
Ionic info
ionic -version 3.20.0
ionic info
cli packages: (C:\Users\Usuario Interax\AppData\Roaming\npm\node_modules)
#ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
#ionic/app-scripts : 3.1.6
Ionic Framework : ionic-angular 3.9.2
System:
Node : v6.11.5
npm : 5.6.0
OS : Windows 10
Misc:
backend : pro
I found this print in console:
exception nativeEvalAndFetch : ReferenceError: Can't find variable: cordova
global code about:blank 1:127
global code script element 1:1:127
The application stop in splashscreen and don't go to principal screen.
Searching more thoroughly found this:
exception nativeEvalAndFetch : ReferenceError: Can't find variable: cordova
try {
cordova.require('cordova/exec').nativeEvalAndFetch(function() {
cordova.fireDocumentEvent('active');
})
} catch (e) {
console.log('exception nativeEvalAndFetch : ' + e);
};
The bug only happens in iOS, Android works good.
Cheking this post: https://www.outsystems.com/forums/discussion/35329/post-ios-11-3-mobile-app-freeze-crash-on-resume-after-sleep-silk-ui/
I tested it in iOS version 10.3.3 and the function of the application is correct, so there is an error in the new version 11.3 and also in the 11.4.
The issue was fixed in a pullrequest in the cordova-ios repository (see https://github.com/apache/cordova-ios/pull/363/files 38). Nevertheless, there does not exist an update with this PR yet. Therefore, I decided to download the fixed file and after adding the ios platform, I replace the old CDVViewController.m on my own. For me this worked and my > 2000 user do not experience this issue anymore.
The path to the old file is platforms/ios/CordovaLib/Classes/Public/CDVViewController.m.
Remember to replace this file everytime after removing/adding the platform. I use for this (and other things) a shellscript to prepare my working directory before building.
I hope this will help you.
Gratitude Mike1707 to provide a workaround Forum response https://forum.ionicframework.com/t/problem-with-ios-in-the-background-after-time/131592/6

Error while Running ionic 3 on iOS

I developed an ionic 3 application on the windows operating system (Windows 8) build the app for android and everything work fine.
Then I need to build for iOS , so I copied the project to MacBook to build for IOS.
I have run the latest npm but when I run
ionic Cordova emulate ios --target="iPhone-X"
it load the simulator but then displays the error below
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
logPath: /Users/lekan/desktop/testProject/platforms/ios/cordova/console.log
What are my doing wrong
Below is my ionic info
ionic info
Result
cli packages: (/usr/local/lib/node_modules)
#ionic/cli-utils : 1.15.2
ionic (Ionic CLI) : 3.15.2
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
#ionic/app-scripts : 3.0.0
Cordova Platforms : android 6.2.3 browser 4.1.0 ios 4.5.2
Ionic Framework : ionic-angular 3.7.1
System:
Node : v6.11.4
npm : 3.10.10
OS : macOS Sierra
Xcode : Xcode 9.0.1 Build version 9A1004
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro
I cant find the error for
ionic Cordova emulate ios
but if you go there
platforms/ios/cordova and click on run file the simulator work perfectly

Resources