question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

crash in iOS build, not in simulator.

See original GitHub issue

Hey all,

I’m really perplexed by an issue with my app. I’m loading some data from async-storage at the sign-in screen of my app. When I run it in the iOS simulator, I don’t have any problems. However, on my iOS build I am getting a white screen.

The first storage call seems to work fine. If I comment out the two other calls afterward, then the white screen never happens on the build (but I obviously don’t get the stored data). I’ve listed some code below.

componentDidMount() {

	// get the correct background image
	AsyncStorage.getItem('APPbackground').then(result => {
		if (result !== null) {
			this.props.setBackground(result);
		}
	});

	// check to see if there is an existing userID
	if (this.props.makeNewUser === false) {
		AsyncStorage.getItem('APPuserID')
			.then(userIDResult => {
				if (userIDResult !== null) {
					this.props.storeUserID(userIDResult);

					// stored password?
					AsyncStorage.getItem('APPuserPass')
					.then(passwordResult => {
						if (passwordResult !== null) {
							// code here to handle the sign in
						} else {
							// console.warn('no password info');
						}
					})
					.catch(error => {
						// error trying to locate login information
						// I show an Alert here
					});
				} else {
					// should we create a new user account?
					// I show an Alert here
				}
			})
			.catch(error => {
				// error trying to locate login information
				// I show an Alert here
			});
	} else {
		// change the settings to reflect a new user rather than a sign-in
		this.props.setLoginText('Create');
		// I show an Alert here
	}

}

I’ve also changed the code to use something like the following as well, but I’m having the same issue.

async _myFunc() {
	try {
		const userIDResult = await AsyncStorage.getItem('WMMuserID');
        } catch (error) {
            // Alert here
        }
}

Expected behavior

  • No crash on iOS build.
  • Error thrown on simulator.

Repro steps

??? Not sure if it can be reproduced.

Environment

  • Async Storage version: 1.6.1
  • React-Native version: 0.60.4
  • Platform tested: iOS 12.4, 12.3.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
infinitelinecommented, Aug 19, 2019

I pulled out all the subsequent code just to test the asyncStorage gets. It works, so there must be something else later in the pipeline that is causing the problem. If it turns out to be related to asyncStorage, I’ll post it, but I’ll close the issue for now. Thank you for all your help @Krizzu!

0reactions
codeoholiccommented, Sep 26, 2019

I faced the same issue but realised integers and boolean caused it. Used JSON.stringify and it works like a charm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashes on iPhone but not iPad or Simulator
Hi, When I launch my app via XCode on my own iPad, everything works fine. When I launch my app on an iPhone...
Read more >
App crash on device but works on simulator iOS - Stack Overflow
The problem was in pods frameworks. Script generated by pods can't embed some frameworks correctly. I removed "[CP] Embed Pods Frameworks" ...
Read more >
Is your app crashing on TestFlight? Issues and potential ...
This article looks into problems that may crash your app on TestFlight and provides potential workarounds and solutions.
Read more >
flutter run crashes when running on ios Simulator: The request ...
Steps to Reproduce Just create new flutter project and run in iOS 10.3.1 simulator. Issue in closed issue #27731.
Read more >
Troubleshooting build errors and crashes - Expo Documentation
To open the full Xcode logs, scroll to the bottom of the build details page when the build has been completed and either...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found