facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.24k stars 24.34k forks source link

React Native 0.61.1 and iOS 13.1.2 leads to lots of unneeded relaunches of our app #26696

Closed bobber205 closed 5 years ago

bobber205 commented 5 years ago

Last week we upgraded to the latest version of React. Around the same time my boss updated his phone to iOS 13.1.2 (got a new phone)

I have a iPhone 5S on my desk with iOS 12.x (whatever the latest in that branch is I updated it today)

I also run the app on my Android 10 phone.

After almost no time at all with the app not focused my boss's phone relaunches the app as if the phone just rebooted. Splash screen and everything. This doesn't happen on the very old iPhone 5. Not on Android either. Of course this relaunch can happen under certain circumstances that are reasonable. For instance my boss will open our app, open up IG and TW, then go back to our app and it relaunches.

We narrowed it down to our upgrade of .60.x to 0.61.1 last Thursday.

This is a very jarring UX issue. I'm not sure how to produce a reproducible use case since it depends on the latest version of iOS and I'm really busy trying to fix other bugs atm related to the new version of iOS. Has anyone else experienced this?

react-native-bot commented 5 years ago

Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

👉 Click here if you want to take another look at the Bug Report issue template.

radko93 commented 5 years ago

Are you sure your app is not crashing in the background? Do you have any crash reporting service enabled?

bobber205 commented 5 years ago

@radko93 Pretty sure it's not crashing. I've narrowed it down to a commit that was responsible for the 0.61 upgrade -- before that commit doesn't matter how long you put the app in the background (say 10 minutes) it's still active when you come back.

We've noticed as little as 1 minute timed of launching the app going over to Instagram and doing literally nothing for a minute then back to our app, relaunch.

We have no background processes for this app. And while we don't have a ton of devices to test on at the moment we have only noticed it on the latest iOS.

oleksandr-dziuban commented 5 years ago

@bobber205 @radko93 Have almost same issue I have described it in https://github.com/facebook/react-native/issues/26746

Just app is really crashing on iOS 13.1.2 when device is sleeping or app just staying in background Stracktrace crash report is available in my issue

bobber205 commented 5 years ago

@oleksandr-dziuban image

radko93 commented 5 years ago

Are you using Websockets @bobber205 @oleksandr-dziuban ?

oleksandr-dziuban commented 5 years ago

Are you using Websockets @bobber205 @oleksandr-dziuban ?

No, I don't use Websockets.

For data transport I use GraphQL based on Apollo Client without Websockets. For Native features I use these libraries only:

    "@react-native-community/async-storage": "1.6.2",
    "@react-native-community/netinfo": "4.2.2",
    "react-native": "0.61.2",
    "react-native-dynamic-fonts": "0.3.1",
    "react-native-image-crop-picker": "0.25.2",
    "react-native-keyboard-aware-scroll-view": "0.9.1",
    "react-native-popup-menu": "0.15.6",
    "react-native-render-html": "4.1.2",
    "react-native-restart": "0.0.13",
    "react-native-router-flux": "4.0.6",
    "react-native-share": "2.0.0",
    "react-native-sqlite-storage": "4.1.0",
    "react-native-svg": "9.9.5",
    "react-native-version-number": "0.3.6",
    "react-native-view-shot": "3.0.2",
    "react-native-webview": "7.2.7",
    "react-native-woodpicker": "0.0.17",
    "rn-fetch-blob": "0.11.2",

There are no background processes in the app.

oleksandr-dziuban commented 5 years ago

@radko93 Just interesting, I have found how to reproduce that even on iOS 13.0 Simulator with Xcode 11.0

1) Just open an application 2) Work with it some time 3) After this click on hardware "ON/OFF" button on Simulator 4) Wait 1-2 minutes to emulate sleep mode 5) Unlock device again 6) Application will be crashed

Veeery tricky issue....

oleksandr-dziuban commented 5 years ago

@radko93 Yes, very easy to reproduce even on newest iOS 13.1 Simulator (Xcode 11.1)

Also reproduced on iOS 13.1 Simulator iPhone 11 (Xcode 11.1):

  1. Open an application
  2. Emulate device sleep mode: click on hardware "ON/OFF" button on Simulator
  3. Screen should be black now
  4. Wait 1-2 minutes in this sleep mode
  5. Unlock device again
  6. Application will be crashed without any error

For best crash detection I use react-native-debugger with Memory Tab: when application will be crashed - we will see that in Select Javascript Area VM instance field

radko93 commented 5 years ago

@oleksandr-dziuban it's complicated because I cannot reproduce it for now with my app on RN 0.61.2.

oleksandr-dziuban commented 5 years ago

Did you wait 1-2 minutes in sleep mode on simulator?

oleksandr-dziuban commented 5 years ago

Maybe this is native libraries specific issue? Some library is crashing in sleep mode, maybe react-native-webview, maybe netinfo.... Tricky case....

radko93 commented 5 years ago

@oleksandr-dziuban I wait 10 or more minutes on iPhone 6s with latest iOS (Release build). Might be netinfo, try to comment it out. Try to comment out different things and see if it helps.

oleksandr-dziuban commented 5 years ago

@radko93

I'm using Apollo Client for GraphQL data transport, it can use Websockets under the hood for GraphQL subscriptions

Maybe this causing crash

Additionally I will comment all Native packages one by one to check

oleksandr-dziuban commented 5 years ago

Disabled NetInfo, WebView - nothing changed

oleksandr-dziuban commented 5 years ago

@radko93 I have reproduced this even on fresh react-native app without any additional code!

Steps: 1) Use iOS 13.0 or 13.1 Simulator, Xcode 11.0 or 11.1, react-native@0.61.2 2) Generate fresh app: react-native init TestApp 3) Run iOS app in Simulator: react-native run-ios --simulator="iPhone 11" 4) Wait until application will be assembled and home screen activated 5) Click on Hardware Power Button on the right side in Simulator, device will activate sleep mode 6) Wait ~ 1 min and Unlock Simulator screen 7) Application will be crashed

SYoder1 commented 5 years ago

This is the same issue that I am seeing, but I am on react-native: 0.59.8

bobber205 commented 5 years ago

Are you using Websockets @bobber205 @oleksandr-dziuban ?

i don't use Websockets either.

bobber205 commented 5 years ago

@SYoder1 Good to know! I think that means this is a React Native + newest version of iOS issue not specific to a version of react (seems that way anyway)

SYoder1 commented 5 years ago

@bobber205 I am also not using Websockets

oleksandr-dziuban commented 5 years ago

@bobber205 Yes, I think in iOS 13 we have new mechanism for sleep/awake in apps and something went wrong now with react-native apps.

ozgursoy commented 5 years ago

@oleksandr-dziuban I tried but my app did not crash. But i added some capabilities on Xcode

Background Modes is enabled Audio, Airplay ... Background Fetch Remote notifications

and these are selected

oleksandr-dziuban commented 5 years ago

I will try to do the same

oleksandr-dziuban commented 5 years ago

@farad4y @bobber205 I have added this capabilities. I see a bit different behaviour now: Application is not crashing, it is in Active App List, but when I select it again it starting from scratch. Looks like app was totally refreshed, something like when RAM is not enough to keep app active.

bobber205 commented 5 years ago

@oleksandr-dziuban That's exactly what we're seeing.

oleksandr-dziuban commented 5 years ago

@bobber205 @farad4y Background Modes requires additional setup for BGTaskSchedulerPermittedIdentifiers in Info.plist. Otherwise we can't deploy app to store

oleksandr-dziuban commented 5 years ago

I don't think Background Modes solves the issue

ozgursoy commented 5 years ago

@bobber205 @farad4y Background Modes requires additional setup for BGTaskSchedulerPermittedIdentifiers in Info.plist. Otherwise we can't deploy app to store

No, you don't need to add these into info.plist

oleksandr-dziuban commented 5 years ago

@farad4y You need to setup BGTaskSchedulerPermittedIdentifiers in Info.plist to whitelist this background processes. Please read this: https://developer.apple.com/documentation/backgroundtasks/bgtaskscheduler

I found that, because TestFlight iTransporter throws and error with this info when I deploy production build to TestFlight

oleksandr-dziuban commented 5 years ago
[16:31:35]: [iTMSTransporter] 1 package(s) were not uploaded because they had problems:

[16:31:35]: [iTMSTransporter]   /var/folders/1b/gl7yt7ds26vcyr1pkgld6l040000gn/T/d20191008-871-5aoqp7/1446718467.itmsp - Error Messages:

[16:31:35]: [iTMSTransporter]       ERROR ITMS-90771: "Missing Info.plist value. The Info.plist key 'BGTaskSchedulerPermittedIdentifiers' must contain a list of identifiers used to submit and handle tasks when 'UIBackgroundModes' has a value of 'PROCESSING'. For more information, refer to the Information Property List Key Reference at https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html."

[16:31:35]: [iTMSTransporter] [2019-10-08 16:31:34 PDT] <main> DBG-X: Returning 1

[16:31:35]: iTunes Transporter output above ^
oleksandr-dziuban commented 5 years ago

I really don't need Background Modes because I don't have tasks for that, I can't add anything to info.plist Application should work correctly on iOS 13.1 in sleep mode without any crash. I think this is React Native issue for iOS 13 phones only, because on iPad OS 13 on iPads I don';t have crashes. iPad OS 13 now is separate OS for tablets. It doesn't have issues with sleep mode for react-native apps

oleksandr-dziuban commented 5 years ago

Guys, is it possible to research this issue? I have added crash Report from production users in my separate issue ticket: https://github.com/facebook/react-native/issues/26746 It happens on iOS 13 on iPhones only (I saw crash reports for iPhones 6S, 8, 11)

Thanks a lot for you help

hackdie commented 5 years ago

having exactly same issue as you @oleksandr-dziuban. have you found something new?

oleksandr-dziuban commented 5 years ago

having exactly same issue as you @oleksandr-dziuban. have you found something new?

Hi, @hackdie No, didn't found yet how to fix this issue. React Native team don't have ideas yet too... Only one possible fix maybe can help:

hackdie commented 5 years ago

having exactly same issue as you @oleksandr-dziuban. have you found something new?

Hi, @hackdie No, didn't found yet how to fix this issue. React Native team don't have ideas yet too... Only one possible fix maybe can help:

  • I'm building iOS/Android app on CircleCI with automated Fastlane Tool.
  • I'm still building app with Xcode 10.2.1 CircleCI image
  • I can't switch to latest Xcode 11.1.0 CircleCI image, because Fastlane throws an error with it.
  • I created an issue with this error on Fastlane GitHub community.
  • Maybe if we build an app with Xcode 11.1 tools we will not have an issue with Crash in sleep mode on iOS 13, I don't know....
  • Anyway waiting feedback regarding Fastlane Error 65 on Xcode 11.1 image on CircleCI

@oleksandr-dziuban im using Github actions with Fastlane Tool, ill try to set xcode 11 to build the app and let you know if i find something 🤔

oleksandr-dziuban commented 5 years ago

@hackdie Thanks a lot! Waiting your feedback. If crash will not be reproduced, we need to build apps for iOS 13.1 only on Xcode 11.1 then.

javascripter commented 5 years ago

We're also experiencing an almost same issue described here in our production app deployed a couple weeks ago and have gotten some user feedbacks about frequent relaunching too.

We use Sentry to track app crashes, and it seems we are receiving no crash reports around these relaunches.

Recently upgraded to RN 0.61.2, and using WebSocket. I experience this issue on my iPhone XS Max, iOS 13.1.1 From a user feedback it is happening on iPhone 8 with iOS13.1.1 too.

fonov commented 5 years ago

I have same issue when use websocket in my app

https://github.com/facebook/react-native/issues/26731

bitkidd commented 5 years ago

Having the same issue literally

bobber205 commented 5 years ago

Hoping the RN team has seen this -- pretty bad issue on the newest iOS.

dejager commented 5 years ago

Ping.

bitkidd commented 5 years ago

Downgraded to 0.60.6, works fine, so the best way to hotfix is to downgrade, it is pretty simple, took about 10 minutes.

fonov commented 5 years ago

Not possible for me because in 0.61.1 fixed issue with status bar ios 13.

uooq commented 5 years ago

Same issue here-- app gets terminated in the background for no apparent reason. This started immediately after updating from 60.3 to 61.2

We ARE using websockets through this: https://github.com/sendbird/SendBird-SDK-JavaScript but that never gave us trouble in the past.

Glad I found this issue after tearing my hair out trying to figure out what we might possibly be doing wrong. This is a HUGE problem for us.

natelohn commented 5 years ago

We're having the same issue here -- please let us know how to move forward!

bobber205 commented 5 years ago

Don't wanna pile on @radko93 but since he's the only RN rep on this thread -- can this please get prioritized? As you can see this is affecting many people at this point.

<3

JustinPerez commented 5 years ago

Same issue for my team. Thank you for starting this thread. We upgraded to 61.2 and our app is constantly relaunching.

bobber205 commented 5 years ago

@JustinPerez are you seeing this on iOS 12 or just 13?

radko93 commented 5 years ago

I will try to bring more attention but I cannot really promise anything right now.

oleksandr-dziuban commented 5 years ago

iOS 13.2 released, interesting is this issue still exists on it? Will check