Reference to the slidingViewController from the AppDelegate to open a view - appdelegate

I need to open a view as topViewController from the AppDelegate method :
(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:
(NSString *)sourceApplication annotation:(id)annotation
but I don't know how to make the reference to the slidingViewController....

Related

Xamarin forms IOS App aksing for RootviewController

I am working on Xamarin Forms on VS 2017. Whenever I am running My IOS app it is asking for RootViewController but my other sample app is working perfectly without any exception.
My Other app has a default Implementation of Finishedlaunching. AppDelegate is inherited by FormsApplicationDelegate class
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
My main app works only after I have updated the Finishedlaunching Method. AppDelegate is inherited by UIApplicationDelegate class
UIWindow window;
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
Rg.Plugins.Popup.Popup.Init();
window = new UIWindow(UIScreen.MainScreen.Bounds);
window.RootViewController = new Login().CreateViewController();
window.MakeKeyAndVisible();
return true;
}
My question is when my other app is working fine with default code why my second application is not working and I have to add RootViewController.
Please let me know if I am missing anything.

xamarin.forms detect ios app entering foreground from background

I am creating app in Xamarin.Forms shared proeject. I want to detect app when it comes from background
currently, I have implemented OnActivated method in AppDelegate but this method is also called when we open control center in iphone. I want my app to reconnect with my server when app comes to foreground from background and show message accordingly but this message is also shown when I swipe up and open control center.
In native Xamarin.iOS app, there is a method WillEnterForegroundNotification but this method is not available here.
Is there any method that's called only if app comes from background ?
in App.xaml.cs
protected override void OnResume()
In native Xamarin.iOS app, there is a method
WillEnterForegroundNotification but this method is not available here.
You can access WillEnterForegroundNotification method in Xamarin.forms project, just override it in AppDelegate.cs:
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
public override void WillEnterForeground(UIApplication uiApplication)
{
//handle your event here
base.WillEnterForeground(uiApplication);
}
}

IOS8 Register Notificaton not working. Why?

My app APNS is working well in less then ios8, but in ios8 i am not getting device token, even didRegisterForRemoteNotificationsWithDeviceToken delegate method is not called. Please advise.
I had same problem along with my application and refer below link and resolve this
clickable link
Get Device Token in iOS 8
#ifdef __IPHONE_8_0
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings: (UIUserNotificationSettings *)notificationSettings
{
//register to receive notifications
[application registerForRemoteNotifications];
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler
{
//handle the actions
if ([identifier isEqualToString:#"declineAction"]){
}
else if ([identifier isEqualToString:#"answerAction"]){
}
}
#endif

NavigationController interactivePopGestureRecognizer don't work when hidden

I'm using a NavigationController to display my View that inherit from MvxViewController. My NavigationController is hidden.
If I try to use back with gesture on iOS 7 as
public override void ViewDidLoad()
{
...
this.NavigationController.InteractivePopGestureRecognizer.Enabled = true;
...
}
i have a NullPointer exception on InteractivePopGestureRecognizer
Object reference not set to an instance of an object
how could i simulate back without show navigation controller?

App Delegate can't see View Controller

Am trying to connect the App Delegate to the View Controller in Xcode4, but I can't make the connection for some reason because App Delegate can't see it in the visual object editor.
Have added the view controller in the visual object editor, and changed the class ID to HelloWorldViewController, and have added the code in the App Delegate.h and .m files.
What am I doing wrong?
Here is the code:
testWindowBasedAppDelegate.h
// -- Add a forward reference to the HelloWorldViewController class --
#class HelloWorldViewController;
#import <UIKit/UIKit.h>
#interface testWindowBasedAppAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
//-- create an instance of the view controller --
HelloWorldViewController *viewController;
}
#property (nonatomic, retain) IBOutlet UIWindow *window;
// -- expose the view controller as a property --
#property (nonatomic, retain) HelloWorldViewController *viewController;
#end
testWindowBasedAppDelegate.m
#import "testWindowBasedAppAppDelegate.h"
#import "HelloWorldViewController.h"
#implementation testWindowBasedAppAppDelegate
#synthesize window;
//-- synthesize the property--
#synthesize viewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
//-- add the new view to the current window --
[window addSubview:viewController.view];
[self.window makeKeyAndVisible];
return YES;
}
- (void)dealloc
{
[viewController release];
[window release];
[super dealloc];
}
#end
You need to add an IBOutlet tag for IB to see it. Declare the property as,
#property (nonatomic, retain) IBOutlet HelloWorldViewController *viewController;
This even applies for methods that you want to expose but there you will use IBAction instead. For example,
- (IBAction)doSomething;
Both of these tags are just indicators and are actually declared as,
#define IBAction void
#define IBOutlet

Resources