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.
Related
I am seeing an issue when attempting to use the confirm notifications functionality. It works fine in the dev environment but when uploaded and testing in the control panel or application it doesn't work. The callback returns a null data object and err=true where in the dev environment the data object has the selected button key available to action on. This is the only way to distinguish between the confirm button and cancel button being pressed (for the confirm notification).
The confirm notification documentation is here:
https://github.com/BuildFire/sdk/wiki/How-to-use-Notifications
The console output for the success (in dev/localhost):
Success
The console output for the same code in the control panel (and device):
Failure
This is a known bug that is being worked on. Here is an ugly workaround.
buildfire.notifications.confirm({message:"Are you sure you want to delete this epic?",confirmButton:{type:"danger"}},(e,r)=>{
if(e==1 || r.selectedButton.key == "confirm" ){ // confirmed }};
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]);
}
My app uses an Azure Notification Hub to send messages to both Windows Phone and iOS devices. The problem is that they work if one is called, but it doesn't work if both are called.
For example, If I send a message to an iOS device from my iOS emulator, the following code works fine and the notification appears.
var toast = PrepareMpnsToastPayload("myapp", notificationText);
var appleToast = PrepareAppleToastPayload("myapp", notificationText);
//await NotificationHelper.Instance.Hub.SendMpnsNativeNotificationAsync(toast, userTag);
await NotificationHelper.Instance.Hub.SendAppleNativeNotificationAsync(appleToast, userTag);
However, if I uncomment the SendMpns..() line, the notification never gets to the apple device. When stepping through this code with remote debugging, the call to SendMpns..() doesn't seem to return. I step over it and it just resumes.. and the breakpoint on the SendApple..() call below it never gets hit.
This works the same with the Windows Phone Mpns line (works fine without the apple call).
How am I supposed to send an alert to a user when I don't know what device they are on? I just want to send the notification to all types. Any pointers would be greatly appreciated.
EDIT: The below answers of removing await() did work. However as I now have authenticated notification hub I need to capture the return value of the call so I can see if I need to get another auth token if it has expired!
If posted code runs as trivial console application then we should wait for tasks to be completed. Easiest way to do so is removing await and calling Wait() against Task object returned by xAsync() methods:
NotificationHelper.Instance.Hub.SendMpnsNativeNotificationAsync(toast, userTag).Wait();
NotificationHelper.Instance.Hub.SendAppleNativeNotificationAsync(appleToast, userTag).Wait();
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
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