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:
applicationDidBecomeActive //app finishes loading the first time
applicationWillResignActive //app begins to resign
applicationWillEnterForeground //At this point, I have quickly restarted the app, and this is called
applicationDidEnterBackground //When this delegate is called, the screen goes black
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.
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.
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.
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.
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
Related
Play audio is the main feature of my app, this is what I set:
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
[[AVAudioSession sharedInstance] setActive:YES error:nil];
When audio changed, I set metadata for nowPlayingInfo:
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:playingInfo];
It works well, audio can played in background, and lock screen will show the metadata I set.
But when I play a video in app, example a youtube link in webView. Even though the video has been closed, App will lost the background play audio permission. Lock screen not show metadata anymore, and app can't change audio in background.
This problem happened only in iOS 12, same code still work well in iOS 11. Is anyone have suggestion for this issue?
UIWebView not loading (mobile web page) sometime in iOS 9. I already used ATS bypass using NSAllowsArbitraryLoads.The issues not happening always and works well in iOS 7 and 8.
The delegate method webViewDidStartLoad invoked but webViewDidFinishLoad and didFailLoadWithError is not getting called at all.
Found the solution.All you need to do is remove UIWebView in iOS 9 and use WKWebView.My webpage had some third party calls to twitter,instagram etc which is https.Also I was getting Auth challenge in my webpage..! (Even I disabled the ATS).I found this by using WKWebView,which has the delegate to handle auth challenge.
Set the below delegate to get the auth challenge and handle it.
- (void)webView:(WKWebView *)webView
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
{
SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;
CFDataRef exceptions = SecTrustCopyExceptions(serverTrust);
SecTrustSetExceptions(serverTrust, exceptions);
CFRelease(exceptions);
completionHandler(NSURLSessionAuthChallengeUseCredential,
[NSURLCredential credentialForTrust:serverTrust]);
}
i'm working on mvvmcross for iOS and i'm facing a problem. ViewDidDisappear work fine in simulator but not in a device.
I have to use it to unsubscribe from IMvxMessenger after subscribing in ViewDidLoad, please help, thanks
First of all, i have to thinks for your intervention.
#Stuard
- it's not craching so there is no exceptions.
- Im using MvxViewController
#Alexey
- it is pushed by UINavigationController
i did juste an override on ViewDidDisappear and a breakPoint on it but never enter on it.
By the way, notice that ViewDidDisappearCalled return true.
I have encountered a weird bug with a released app. My UIWebView is no longer loading content on iOS 6, yet the content still displays in the simulator. The activity indicator displays properly but then it loads a blank url? Again, this only happens on a device, not on the simulator.
To provide extra context (in the simulator the NSURLRequest is assigned the proper URL. When run on a device the value is nil.)
Here is my code :
-(void)loading
{
if(!self.webView.loading)
[self.activityIndicator stopAnimating];
else {
[self.activityIndicator startAnimating];
}
}
- (void)viewDidLoad
{
[self.webView addSubview:self.activityIndicator];
NSURLRequest *requestUrl = [NSURLRequest requestWithURL:self.url];
[self.webView loadRequest:requestUrl];
self.timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:#selector(loading) userInfo:nil repeats:YES];
[super viewDidLoad];
NSLog(#"%#", requestUrl);
}
I had a similar issue with our web app (HTML+JS+CSS) not loading on a device, but working fine in a browser and iPhone Simulator. The cause of the issue was the wrong case in filenames. E.g., HTML file wanted to load a file 'Loader.js', whereas its name was 'loader.js'.
So, maybe you should check your 'self.url' (if your 'index.html' has the right case in its filename).
please use web view in nib and debug it to safari developer tools,
so you can trace the actual problem. I use this approach for my application and its working.
process to open developer tools
1-open safari
2-go to preference
3-go to advance option
4- set on to developer tools
After follow above process you can see your safari having option develop.
it means your safari developer tools is active and you can able to debug ios application
Anyone know if it's now feasible to launch the 'Settings' app from your app? Google Maps does it when you don't have Location Services enabled and you try to locate yourself.
I've seen lots of folks post about it and most answers point to adding a bug in Radar.
In the wild, I know of two apps that show this dialog with ""Turn on Location Services to Allow [app] to Determine Your Location" along side Cancel and Settings buttons where the 'Settings' button will take you to the General Settings.
1) Facebook app version 3.3.2 that runs on iOS 3.1.3 shows this alert on start. I looked at the three20 source code in git-hub but that project is not really a full source of the app but more of a library with the app's components.
2) GroupMe also shows the same alert when adding current location to a new message.
You mean the settings of the app like you see in settings?
First create a settings.bundle in xcode>newfile>settings.bundle.
This will create some prop lists that you can edit from out of the Settings.app or your app self. For the exact code Google can help you a lot further that I can. If you have any specific questions; don't hesitate to ask.
In iOS 5.0 you can open settings using the "prefs://" URL scheme. But in iOS 5.1 it doesn't work. But there is a trick I used for login twitter account using settings inside my app. the code is
TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];
// Create the completion handler block.
[tweetViewController setCompletionHandler:^(TWTweetComposeViewControllerResult result)
{
[self dismissModalViewControllerAnimated:YES];
}];
// Present the tweet composition view controller modally.
[self presentModalViewController:tweetViewController animated:YES];
tweetViewController.view.hidden = YES;
for (UIView *view in tweetViewController.view.subviews){
[view removeFromSuperview];
}
Using this code you can switch to settings from your app directly if you are not already logged in twitter account.