I searched through stackoverflow but not saw any problem like this. The all sceneDelegate methods and applicationWillTerminate are not working after I terminate the project from background(swipe up).
First opening of the project every methods works fine while I changing background to project or vice-versa, I can see them work by console. But when applicationWillTerminate func calls first time by background, then I can not see any methods are working. I open the app but not willResign func calls or even I terminate the from background not applicationWillTerminate works... Anyone knows the problem? Thank you.
Xcode Version 11.4.1 (last update)
-Also checked on my device but not work still.
Solved:
When app terminates from background, Xcode suddenly breaks the attachment with simulator. To continue debugging on the same simulator, Debug > Attach to Process > 'Your Application'.
I had an app running on iOS 9 and I created a new build for iOS 10 with Xcode 8 beta 4, now when I upgrade the app from previous version (iOS 9) to the new version (iOS 10) in this scenario...
Install the previous version with Xcode 7 on an iPhone (with ios 9 or 10) then kill the app and install the new version with Xcode 8 beta 4 on the same device it treats the upgrade as a new install so all of the NSUserDefaults saved values return nil!
I tested a sample app and followed the scenarios there was no problem with NSUserDefaults in this case as I used [NSUserDefaults standardUserDefaults] to save and retrieve the values but in the following implementation which has problem its using a shared container to save data, I believe "entitlementGroup" causing the issue!
SDK 10 might not be able to recognize the previously created shared container by SDK 9! Is there any thought on that? The problem is I cannot fix the code by replacing [NSUserDefaults standardUserDefaults] instead of using entitlementGroup because users currently using the previous version of the app and any change to the new version doesn't fix the issue as it requires to be fixed in two versions.
Here is main parts of the code (written by previous developer):
#implementation AppDelegate
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) {
// background launch
} else {
//foreground launch
[self setupForForegroundLaunch:application option:launchOptions];
[[TrackingManager sharedTrackingManager] setIsBackground:NO];
}
}
#end
I noticed that sdk 10 doesn't cause any issue with NSUserDefaults.
It was only ordering issue in the project, in AppDelegate I was calling [[TrackingManager sharedTrackingManager] setIsBackground:NO]; before this line [self setupForForegroundLaunch:application option:launchOptions];
While I generally have initialized the Entitlement_Group in setupForForegroundLaunch function and in singleton of TrackingManager class also Entitlement_Group gets initiated with nil value which this caused the issue I only changed the order of these two line and now everything is working well.
Incase of change in entitlement file cause such kind of issues.Please refer the following links.
AboutEntitlements
I have being seeing crashes in my iOS app, when opening LA Times (www.latimes.com). The crash happens in WebCore somewhere and I have no clue where. Profiling with both "Zombie" or "leaks" do not return anything for this "EXE_BAD_ADDRESS" error.
I also checked with a small, bare UIWebView app and I could reproduce the effects.
Right now, I see this happening only with LA times, but I am not sure if there are other sites as well.
Can someone check on and guide me in what could be the possible error/source for this crash?
EDIT: I have added a small UIWebView project demonstrating this bug at
github
EDIT 2: The app (include the demo at github) works perfectly fine on iOS 7.0, but crashes in iOS 7.1 ... seems a recent bug with iOS 7.1. I have issued a bug report to Apple and will keep updated.
Thanks in advance,
Nikhil
I happened to bump into that same issue with one of my apps in iOS>7.0 only.
It seems to be a sync issue which can be fixed by creating the webview from the main thread only.
As a fix I just wrapped my UIWebView creation in a dispatch_sync(dispatch_get_main_queue(), ^{ ... });
And it solved the problem.
Of course if your code is running on the main thread you shouldn't wrap it this way ;)
I have successfully got pixate 2.0.1 working with XCode 5 on a ios 7 project. Its really awesome actually! And it would be even way more awesome with Real Time CSS. This is basically where the iPhone/iPad simulator will update live while the css file is edited and saved. Now thats just cherry all the way. But unfortunately I'm not yet able to get it working. I followed the directions that Paul Colton gave here: http://youtu.be/rjNrNIyEL_c. But it is for version 1 of Pixate and uses the now outdated PXEngine syntax.
Anybody know how to get this working in version 2.0.1 of Pixate?
Assuming you have followed the latest instructions for installing version 2.x found here: http://www.pixate.com/docs/framework/ios/latest/getting-started/
Then make sure you have the following in your AppDelegate:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//Initalize Pixate
self.window.styleMode = PXStylingNormal;
//Dynamically modify the Pixate stylesheet while the Simulator is running
#ifdef DEBUG
[Pixate styleSheetFromFilePath:#"/Users/YourHomeFolder/Path/To/default.css" withOrigin:PXStylesheetOriginApplication];
Pixate.currentApplicationStylesheet.monitorChanges = YES;
#endif
}
Hopefully that helps.
I'm porting my app to iOS 7 and I have a problem with UIWebView in iOS 7.
I load local html string in it with this code:
NSURL *baseURL = [NSURL fileURLWithPath: DOCUMENTS_DIRECTORY];
[self.descWebView loadHTMLString:html baseURL:baseURL];
It works perfectly on iOS 6 and prior but on iOS 7 it doesn't rendering and the UIWebView is still white. And this message appears in console:
void SendDelegateMessage(NSInvocation *): delegate
(webView:decidePolicyForNavigationAction:request:frame:decisionListener:)
failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode
Thanks for your replies.
As mentioned by #zaplitny, I had to update Crittercism to the latest version (4.1.0) for this problem to go away.
There was a problem with older version of the Crittercism library which caused this. As others have alluded to in comments, this bug was fixed in the 4.3.1 version of the Crittercism SDK.
https://app.crittercism.com/downloads/release_notes/ios/4.3.1 :
fix: Workaround for apps experiencing UIWebViews failing to load data
on first launch when running on iOS 7. This only occurs in apps that
subclass UIWebView, and Crittercism has filed a bug report with Apple.
Note - Be aware that while your application may not directly subclass
UIWebView, this is done in many common 3rd party libraries such as the
Google AdMob and Millenial Media SDKs.
For those of us who updated Crittercism to the version 4.1.2 hoping that it would solve the issue but it didn't. I can offer quite an ugly but simple solution: create and initialize UIWebView before calling [Crittercism enableWithAppID:#"***...***"];
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
...
UIWebView* fakeWebView = [[[UIWebView alloc] initWithFrame:CGRectMake(-1, -1, 1, 1)] autorelease];
[fakeWebView loadHTMLString:#"<!DOCTYPE HTML><html><body>I need Crittercism</body></html>" baseURL:nil];
[mainViewController.view addSubview:fakeWebView];
[Crittercism enableWithAppID:#"***...***"];
...
}
This trick allowed me not only to get rid of a described problem, but also slightly speed up the first initialization of a real UIWebView.
I had this error appearing trying to display admob ads, when ever crittercism was enabled I would get that error in the logs, incidentally the ads were not displaying either.
To fix it, I disabled crittercism instrumentation, this might not be an option for everyone.
[Crittercism enableWithAppID:#"your_app_id" andDelegate:nil andURLFilters:nil disableInstrumentation:YES];
If not simply creating a webview (You don't need to add it as a subview) as suggested by others seems to work for me as well.
[[UIWebView alloc] initWithFrame:CGRectMake(-1, -1, 1, 1)]
[Crittercism enableWithAppID:#"your_app_id"];
Try product --> clean. It can't hurt. When you run an app it will only replace/compile the files that changed. Some times the xCode bugs up and doesn't compile a changed file. Product clean deletes old versions of the compiled code so next time you build it will have been all from the last compile. Again you have nothing to lose by doing it.
I am seeing the same problem you are. I have tried:
moving the load request from the viewDidLoad to the viewWillAppear and viewDidAppear, this did not help anything
tried reloading the webview after the load request was made. still nothing
tried changing the URL creation from URLWithString to fileURLWithPath and still nothing
What is even more strange is that none of the delegate methods fire when the page doesnt load. it is almost as if the web view doesnt even attempt to load the page. Yet, like you said, if you close the app from the multitask view and reopen it, everything works fine.
were you able to figure out a way around this or found a solution?
I had similar issues with my PhoneGap application on IOS7, i had to Redraw the UI of the page on "viewDidAppear" or "Pageshow" using the below code and this worked for me.
$(".cls_div_page_content").redraw();
jQuery.fn.redraw = function() {
return this.hide(0, function(){$(this).show()});
};
many times this error can come in case u are using something that is not available in that particular iOS version..
for example
NSString *test=#"test this";
[test containsString:#"test"];
use of containsString in iOS 7.1 will give you the same following error, but it will work fine in iOS 8.0,
void SendDelegateMessage(NSInvocation *): delegate (webView:decidePolicyForNavigationAction:request:frame:decisionListener:)
failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode
I ran into this issue too. It seems the problem is caused when certain 3rd party libraries are linked, but I am not even sure exactly which one was responsible in my case. I didn't have Crittercism in my app.
What fixed it for me was the suggestion I found here on Apple's Dev Forum to instantiate a UIWebView early.
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// In a severe case of WTF: some 3rd party libs (exact culprit unknown) can cause webviews to stop
// showing anything on iOS 7, and instead have console warnings every 10 seconds that look like:
// void SendDelegateMessage(NSInvocation *): delegate (webView:decidePolicyForNavigationAction:request:frame:decisionListener:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode
// Just instantiating an UIWebView before any of the 3rd party libs kick in is enough to fix it.
// Don't know why, but it works.
if (SYSTEM_VERSION_LESS_THAN(#"8.0")) {
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];
webView.delegate = nil; // Do something with webView to silence warning
}
return YES;
}
For those who are using Parse SDK with the 1.6.x version under iOS7/iOS8 and subclass UIWebView, same problem will appear if you are using PFInstallation saveInBackground method.
Solution is to delay call saveInBackground, e.g.:
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 3.f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[currentInstallation saveInBackground];
});