Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

ionic app suddenly crashes and closes itself in ios #59

Open
jgw96 opened this issue Jan 13, 2017 · 41 comments
Open

ionic app suddenly crashes and closes itself in ios #59

jgw96 opened this issue Jan 13, 2017 · 41 comments
Labels

Comments

@jgw96
Copy link
Contributor

jgw96 commented Jan 13, 2017

From @vahidvdn on December 2, 2016 6:35

Ionic version:
1.3.1

I'm submitting a ...
bug report

Current behavior:
Recently I confronted with a problem in my ionic app. This only appears in ios 9 (I didn't test in other versions of ios). Why I said recently? Since a few days a go, I didn't have a lot of data in my remote database. No when I load some data with ion-infinite-scroll , and change some states, suddenly app closes with NO ERRORS.

Other information:
I use gapDebug for watching the console log. But no errors appears. Any idea?
e6fbeece-b7ec-11e6-9487-fe4e3b0f8a5c

Ionic info:

Cordova CLI: 5.4.0
Gulp version:  CLI version 3.9.1
Gulp local:
Ionic Framework Version: 1.3.1
Ionic CLI Version: 2.0.0
Ionic App Lib Version: 2.0.0-beta.20
OS: Windows 7 SP1
Node Version: v4.5.0

Copied from original issue: ionic-team/ionic-framework#9455

@jgw96
Copy link
Contributor Author

jgw96 commented Jan 13, 2017

From @faraazc on December 2, 2016 7:2

@vahidvdn please update ionic libs to latest RC.3. I faced similar issue. upgrading to latest did fix.

@jgw96 jgw96 added the v1 label Jan 13, 2017
@jgw96
Copy link
Contributor Author

jgw96 commented Jan 13, 2017

From @vahidvdn on December 2, 2016 8:34

@faraazc I'm not able to update it. I run this command:
ionic lib update or even ionic lib , I get this error:

This command has been deprecate.  All resources are currently available in NPM and we recommend that you use NPM to manage these.
More information is available here: https://github.com/driftyco/ionic-cli/wiki/Migrating-to-NPM-from-bower

Local Ionic version: 1.3.1  (C:\Users\Cebit\myApp06\www\lib\ionic\bower.json)
Invalid version: undefined

@jgw96
Copy link
Contributor Author

jgw96 commented Jan 13, 2017

From @vahidvdn on December 7, 2016 13:37

Recently I found out this issue also occurs in ios 10 in a iphone 6 mobile. (Actually this happens hardly ever on ios 10)

Any solution?

@jgw96
Copy link
Contributor Author

jgw96 commented Jan 13, 2017

From @vahidvdn on December 15, 2016 8:26

After spending a lot of time, I couldn't be able to solve this issue.

But I found out, When I go to the child tab in ionic tab component, this occurs, or when there is a lot of xmlHttpRequest that happens in ion-infinite-scroll. It seems there is memory or cpu issues as discussed in some places like here or here.

NOTE: I even updated my cordova cli and cordova-ios , but no difference.

No one has any idea?

@vahidvdn
Copy link

Still no solution? Anybody?

@cozzbie
Copy link

cozzbie commented Feb 10, 2017

@vahidvdn
Copy link

@cozzbie I couldn't find mentioned code. How should I fix it?

@cozzbie
Copy link

cozzbie commented Feb 12, 2017

The problem you are definitely facing is from a poor design of the UIView used in old iOS. It causes uncontrollable memory leaks. Head over to http://blog.ionic.io/cordova-ios-performance-improvements-drop-in-speed-with-wkwebview/ for a more efficient view with WKWebView. Although it seems to be still experimental, I can guarantee that its very much improved with no leaks @vahidvdn

@vahidvdn
Copy link

@cozzbie Thanks. I have already tried WKWebView , but I couldn't be able to run it. It showed me blank white page. But I should try it again. Maybe I missed something.

@cozzbie
Copy link

cozzbie commented Feb 12, 2017

Check your permissions @vahidvdn and your <meta http-equiv="Content-Security-Policy">. Those are the usual culprits for the whitescreen issue

@vahidvdn
Copy link

@cozzbie Ok, I'll test it. Thank you.

@vahidvdn
Copy link

@cozzbie I found out something interesting. By this code:

if (window.indexedDB) {
   alert("I'm in WKWebView!");
} else {
   alert("I'm in UIWebView");
}

I could be able to find out my iphone is using which type of webview. In an iphone 4s (ios 9.3) it alerts UIWebView , but in an iphone 6 it alerts WKWebView.

In UIWebView it crashes very fast (after some page transition and request) , but in WKWebView it's better (but still occurs)

@cozzbie
Copy link

cozzbie commented Feb 12, 2017

WKWebView was introduced in iOS 9 so I really wonder why your iPhone 9.3 is using the UIWebView. Well, there you have it. Try to not create very large lists and you'd be fine. @vahidvdn

@vahidvdn
Copy link

vahidvdn commented Feb 12, 2017

@cozzbie My list is too short. Just loading 3 items and fetching more data by ion-infinite-scroll. This issue seems to relates to ion-tabs transition. In single state works fine, but when I go to other tabs and states, it occurs :(

@cozzbie
Copy link

cozzbie commented Feb 13, 2017

Yeah because as you move between states...listeners are rapidly created and not destroyed between them hence the memory build up. I suggest not using the ion-infinite-scroll and try implementing something of yours and also watch for which tab causes the most memory jump in your app. @vahidvdn

@vahidvdn
Copy link

.listeners are rapidly created and not destroyed

Do you mean it relates to caching states?

And it's interesting, it just happens in ios, never in the android. And ionic team claims the high performance in the ios.

Any way, thanks.

@amadercode
Copy link

I am getting the same issue with Ionic 3.3.0 for IOS 10.32 iphone as well as simulator. Even it does not show home page, just crashing after opening splashing but android app using same code base is working very fine as i want.

What is going to IOS

Not only that , i do not get any debug file named console.log at

my_mac_project_path/platforms/ios/cordova/console.log
There is only log as

CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)

tail -f "$CORDOVA_PATH/console.log"

Additional:
I have tried only the blank app to confirm with fcm ionic-native plugin only but same result.

so now not only app is crashed but also my head with the pain after trying severals try.

i am really looking forward reply from the ionic team ASAP.

Thanks in advance after all.

@RoyTal28
Copy link

I am having the same problem as abumuwaz .
I have and application that works fine on Android , yet when running it on Iphone - I am getting the splash screen and then it crashes.
I have no logs .

Please help ,

Thanks!

@vahidvdn
Copy link

vahidvdn commented Jul 1, 2017

@abumuwaz @RoyTal28
Also your case happened to me. What is your ionic-cli version? I updated my ionic-cli, then my App didn't work at all. Then downgraded to version 2.0.0
Try this:

npm uninstall -g ionic
npm install -g ionic@2.0.0

Please let me know if it works for you too.

@nalkon
Copy link

nalkon commented Jul 27, 2017

I have similar problem. My app works fine on Android and crashes on iOS after couple of clicks. If I run it from XCode I get this error: "Message from debugger: Terminated due to memory issue".

My iPhone is iOS 10.3.2

My ionic environment:
global packages:

@ionic/cli-utils : 1.5.0
Cordova CLI      : 7.0.1 
Ionic CLI        : 3.5.0

local packages:

@ionic/app-scripts              : 2.0.2
@ionic/cli-plugin-cordova       : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms               : ios 4.4.0
Ionic Framework                 : ionic-angular 3.5.3

System:

Node       : v8.1.3
OS         : macOS Sierra
Xcode      : Xcode 8.3.3 Build version 8E3004b 
ios-deploy : 1.9.1 
ios-sim    : not installed
npm        : 5.3.0 

Have anybody found solution or what causes it?

Thanks.

@RoyTal28
Copy link

RoyTal28 commented Jul 30, 2017 via email

@nalkon
Copy link

nalkon commented Jul 30, 2017

I don't use Firebase, but thanks any way!

@vahidvdn
Copy link

vahidvdn commented Jul 30, 2017

@nalkon My problem was memory leak too. Do you have ng-repeat in your app? It keeps all elements in list alive. Try to use vs-repeat. That's a very awesome library, that removes elements as you scroll.

Note: ionic collection-repeat also is good for performance, but has some problems.

@vahidvdn
Copy link

vahidvdn commented Aug 1, 2017

Actually vs-repeat has some issues. It has some lags while scrolling. Also collection-repeat has some issues when we have photo in out list (discussed here).

So, there is no other way rather than ng-repeat and ng-repeat has memory leak issue. Maybe ionic2/3 has solved this problem.

@geshub
Copy link

geshub commented Aug 1, 2017

I was hoping to solve my collection-repeat problems with vs-repeat ...
I'm struggling with lag when scrolling my lists ( with photos ), it looks very bad on IOS even on iphone 7.

@nalkon
Copy link

nalkon commented Aug 1, 2017

I don't have neither ng-repeat nor vs-repeat. I use ngFor.
Also, after some investigation what I found is the app works fine if I don't load images. It crashes only if I load images. Not sure yet why. There are definite spikes in memory when the app renders, but it goes back to the "normal" amount of memory after some time. And still, it always crashes after some scrolling. I think I'm going to open another issue for the current version.

@vahidvdn
Copy link

vahidvdn commented Aug 1, 2017

@nalkon So, your using ionic2/Angular2 as you mentioned to ngFor. There are a lot of improvement in Angular2. But the story is still the same. You keep all elements in DOM, then it leads to memory leak.

In ionic2 collection-repeat is virtualScroll. Maybe this help you. (Please let me know about the result of virtualScroll)

@vahidvdn
Copy link

vahidvdn commented Aug 1, 2017

@geshub vs-repeat is really bad in ios! The performance is extremely high, but scrolling is really awful.

@nalkon
Copy link

nalkon commented Aug 1, 2017

I tried to use VirtualScroll some time ago and had a lot of problems with it, basically didn't manage to get it work. But there were a lot of changes since then. So, I'm going to give it another try. I'll let you know.

@geshub
Copy link

geshub commented Aug 1, 2017

@vahidvdn thanks for the input. Did you manage to get a smooth scroll on IOS with large ( infinite scroll ) lists with photos ?

@vahidvdn
Copy link

vahidvdn commented Aug 1, 2017

@geshub No I couldn't. After a few weeks working on both collection-repeat and vs-repeat I decided to use simple ng-repeat. That's really disappointing.

@nalkon
Copy link

nalkon commented Aug 7, 2017

Just wanted to let you guys know that it seems like I solved my main problem. I'm still not sure what caused it. Probably number of things that didn't work well together. To solve it I completely re-wrote html with scroll and list. I took as an example the html from Ionic Conference app and tweaked it to my purposes. It uses virtualScroll and grid. My app doesn't crash any more and even performance is decent. However I'm having other problems now, but they have to do with the app functionality and the way the app worked with the "old" html. I probably will need to re-write parts of the code. But over all it's a good news. Took me week and a half to get there.

@ghost
Copy link

ghost commented Aug 9, 2017

I am also having similar crashing issues, happens when loading multiple large images and scrolling at the same time, don't scroll while loading and it doesnt crash, scroll while loading and it does. Both instances scrolling is slow.

The crash is a low memory warning from iOS JetSam https://jsonblob.com/36319992-7d2d-11e7-9e0d-3748a4205ba9

@divinzer
Copy link

@nalkon Thank you for good information, may I how can use virtualScroll and grid on IONIC?

@varsha123
Copy link

Hello

I am facing same also facing memory leak issue on ios only and because of this app is getting crashed after some time. App is build using ionic2 and cordova 7.0.1.

To resolve this I have added WKWebView plugin in ionic2 application.
I am getting device ready fired but native plugin not working as I have below code in app.components.ts
StatusBar.styleDefault();
Splashscreen.hide();
I am not getting console or alert after these 2 lines. That was getting with UIWebview.

Please let me know what is wrong in this case.

Thanks
Varsha

@vahidvdn
Copy link

@varsha123 Try NativeScript 😆

@varsha123
Copy link

I have already added native plugins of statusbar and splashscreen those are working with old UIWebview.
Now i am facing issue with WKWebView with this webview plugins not working.
Can we use all ionic or codova native plugin with WKWebView? Why do we need to nativescript? Please give more details on this as this is my first ionic app so not getting me usevof native script here.

Thanks
Varsha

@cozzbie
Copy link

cozzbie commented Aug 23, 2017

NativeScript is not the same as native plugins. NativeScript is a framework much like Ionic. What @vahidvdn is basically telling you to do is port your entire app from Ionic to NativeScript. @varsha123

As far as your issue goes, try reinstalling the ios platform by deleting and re-downloading it so that your plugins are refreshed. But first, remove and reinstall your plugins and try upgrading to Ionic 3.

@MikeCIDFG
Copy link

Ran into this issue today nearly a year after the last posts.

Filtering a long list of (~400) items caused the app to crash only on an older iPad running iOS 10.3. No issues on Android, and although slow on an iPhone 5S (also running 10.3) it didn't crash.

Installing the latest WKWebView plugin solved the problem.
The list filters fine now, the virtualScroll is more responsive, and crashes are gone!
ionic cordova plugin add cordova-plugin-ionic-webview

@kollisandy
Copy link

@shanemac10
Copy link

shanemac10 commented Feb 28, 2019

For weeks now I've been chasing an issue with my iOS app crashing on multiple devises around the same time, and at what seemed like random timeframes. Come to find out when you run your app from Xcode on a devise, Apple gives your default provisioning profile about a week or less to run, then the app won't open any longer when that time runs out. Then you have to re-run it from Xcode. I thought it was a bug, or a memory leak or something, but no, it was just the default settings on my Apple developer account. I had no idea.

If you are chasing this issue, you might first make sure your Apple certificates and provisioning profiles are in order.

Checkout my answer on StackOverflow for more info...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests