0

Some users of my app are unexpectedly quitting the app before they complete what they should do. I am suspecting if the app gets frozen. How to check which page user saw at last? I would like to save that data to firebase to analyze.

Simply I want to know where users are quitting the app.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
birdcage
  • 2,638
  • 4
  • 35
  • 58
  • you can implement some metrics (Adobe, Google, etc...) in your app to get more information about your users' behaviours. – holex Oct 16 '18 at 07:30
  • Firebase offers Performance SDK to monitor the overall performance of the app. You can find out which screen is causing frozen frame or slow rendering. You just have to integrate the SDK and put the app on store and you'll start seeing data in your console(After Firebase collects enough samples). https://firebase.google.com/docs/perf-mon/get-started-ios – ebby94 Oct 16 '18 at 09:53

2 Answers2

-1

There isn't any default method which you can use in this case. This is what you can do, in your every view controller's viewDidAppear save that screen's name in UserDefaults overwriting the previous value. Now on every app launch, check if the app was crashed last time it was opened, if it was crashed then get the screen name from UserDefaults and save it to firebase.

If you don't know how to detect an app crash, use this link.
https://stackoverflow.com/a/37220742/1811810

Ehsan Saddique
  • 638
  • 4
  • 12
-1

Apple offer that NSSetUncaughtExceptionHandler to listen whether the app is crash, so ,you can when app launch use this listener to save the crash log,

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ 
    //get crash report
    [self installUncaughtExceptionHandler]; 
}

and the implementation is:

- (void)installUncaughtExceptionHandler {
   NSSetUncaughtExceptionHandler(&UncaughtExceptionHandler);
 }
  void UncaughtExceptionHandler(NSException *exception) {
    NSArray *arr = [exception callStackSymbols];
    NSString *reason = [exception reason];
    NSString *name = [exception name];
    NSString *currentVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
    NSString *urlStr = [NSString stringWithFormat:@"mailto://developer@googlemail.com?subject=CrashReport&body=YourSuggest!<br><br><br>""errorInfo(%@):<br>%@<br>-----------------------<br>%@<br>---------------------<br>%@",currentVersion,name,reason,[arr componentsJoinedByString:@"<br>"]];
    NSURL *url = [NSURL URLWithString:[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
   [[UIApplication sharedApplication]openURL:url];
 }

And suggest that you can send email to tell developer,if the customer allow that. I think this error info can contain the crash page's info,hope this can help you.

Junior Jiang
  • 12,430
  • 1
  • 10
  • 30