App hangs on restart with latest Flurry SDK and ios4
Asked Answered
O

4

7

I have a frustrating problem with the latest version of Flurry (Flurry iPhone SDK v2.5). When I start my app, quickly exit, then restart the App, the app briefly loads, flickers a black screen, then stays on the black screen. The black screen stays there until I press the home button, at which point I can restart the app normally. I looked into this further, and it turns out that app state delegates are getting called in the wrong order:

  1. applicationDidBecomeActive //app finishes loading the first time
  2. applicationWillResignActive //app begins to resign
  3. applicationWillEnterForeground //At this point, I have quickly restarted the app, and this is called
  4. applicationDidEnterBackground //When this delegate is called, the screen goes black
  5. applicationDidEnterBackground //This gets called when I hit the home button again, after the screen has been hanging for a while.

So what I think this means is some processes take a bit longer to wrap up once I hit the home button, and if I try to start the app again too quickly there is some very odd behavior. If I wait a few seconds to restart the app, the app behaves normally.

To demonstrate this problem, I created the simplest app I could think of, which I will post here. I built this with XCode 3.2.3, in the 4.0 build directly onto my iphone device (iphone 4). This is important, because I couldn't reproduce this problem on the simulator. You can reproduce this app by creating a new navigation based project named simpleApp, and dropping this code in, with your own Flurry API key of course. Here is simpleAppAppDelegate.m:

#import "simpleAppAppDelegate.h"
#import "RootViewController.h"
#import "FlurryAPI.h"


@implementation simpleAppAppDelegate

@synthesize window;
@synthesize navigationController;


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    [FlurryAPI startSession:@"<your api key here>"];    

    [window addSubview:navigationController.view];
    [window makeKeyAndVisible];

    return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
    printf("applicationWillResignActive\n");
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
    printf("applicationDidEnterBackground\n");
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
    printf("applicationWillEnterForeground\n");
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    printf("applicationDidBecomeActive\n");
}


- (void)applicationWillTerminate:(UIApplication *)application {
    printf("applicationWillTerminate\n");
}

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
}

- (void)dealloc {
    [navigationController release];
    [window release];
    [super dealloc];
}

@end

And here is simpleAppAppDelegate.h:

#import <UIKit/UIKit.h>

@interface simpleAppAppDelegate : NSObject <UIApplicationDelegate> {

    UIWindow *window;
    UINavigationController *navigationController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;

@end

So anyway, because so many apps are using Flurry I feel like I must be missing something very basic. What really boggles my mind is that I haven't found anyone at all complaining about this particular problem. Also, this is different from the problem in previous versions where the app would appear to start immediately, go black for a few seconds, then resume normally. That problem was solved by calling [FlurryAPI setSessionReportsOnCloseEnabled:false]; after I set the session, but that doesn't help in this case.

Anyway, has anyone else had this problem? I really hope it's just a stupid error on my part. I'm really excited to use Flurry but something like this would cause my app to get rejected.

Ornithic answered 3/7, 2010 at 8:36 Comment(2)
Can confirm that the latest update of the API solves the problem!Monteux
Still having this issue today with the latest SDK of FlurrySkeptical
C
6

I wrote Flurry about this and they got back to me really quickly that they'd look into this. About a week later they wrote back and said they fixed it in v2.6 which is now available. I can't seem to reproduce the problem anymore.

Not to say I'm awesome or anything, but I did kind of single handedly fix this bug.

Connelly answered 14/7, 2010 at 20:47 Comment(0)
O
2

I'm not sure whether I should be answering my own question in a comment to the original post or to post an answer, but in any case here is the answer:

Flurry is broken, it's been confirmed by others on this apple dev forum thread (you need an account to login):https://devforums.apple.com/thread/56339?tstart=0

Here's hoping Flurry gets a new version out soon, I'd really like to incorporate their offerings into my app.

Ornithic answered 7/7, 2010 at 7:31 Comment(0)
P
2

I take this from flurry. Version 2.7 also has the problem but:

[FlurryAPI setSessionReportsOnCloseEnabled:(BOOL)sendSessionReportsOnClose];

This option is on by default. When enabled, Flurry will attempt to send session data when the app is exited as well as it normally does when the app is started. This will improve the speed at which your application analytics are updated but can prolong the app termination process due to network latency. In some cases, the network latency can cause the app to crash.

Pestilent answered 30/10, 2010 at 5:36 Comment(0)
B
1

We just released a new version of the iPhone Flurry SDK that should resolve this issue. Please download this new SDK and let us know if it resolves the issue you are encountering.

-- Sincerely,

-Sheila

Flurry Support

Belamy answered 13/7, 2010 at 23:54 Comment(2)
2.7 crashes on load as well on app load. Any update to a fix for 2.7?Oakleil
No it doesn't...when I fast switch back to the app it hangs for a few seconds.Alberthaalberti

© 2022 - 2024 — McMap. All rights reserved.