// // 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()); var appid = "1110584378"; MessagingCenter.Subscribe <object>(this, MainPage.QQShare, o => { var tencentOAuth = new TencentOAuth(appid, new OAuthTencentSessionDelegate()); var textObj = new QQApiTextObject("这是来自Xamarin的QQ分享"); var req = SendMessageToQQReq.ReqWithContent(textObj); QQApiInterface.SendReq(req); }); MessagingCenter.Subscribe <object>(this, MainPage.QQLogin, o => { var k1 = TencentOpenAPI.sdkdef.Constants.kOPEN_PERMISSION_GET_USER_INFO; var k2 = TencentOpenAPI.sdkdef.Constants.kOPEN_PERMISSION_GET_SIMPLE_USER_INFO; var para = new NSObject[] { k1, k2 }; var tencentOAuth = new TencentOAuth(appid, new OAuthTencentSessionDelegate()); var result = tencentOAuth.Authorize(para); }); return(base.FinishedLaunching(app, options)); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. _delegate = new LoginDelegate(); _delegate.LoginSuccess += (s, e) => { var x = _tencentOAuth.UserInfo; }; _tencentOAuth = new TencentOAuth("1106970090", _delegate); }
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) { var urlKey = options[UIApplication.LaunchOptionsUrlKey]?.ToString(); if (urlKey == "com.tencent.mqq") { // QQ 的回调 return TencentOAuth.HandleOpenURL(url); } return base.OpenUrl(app, url, options); }
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) { var keys = new UIApplicationOpenUrlOptions(options); if (keys?.SourceApplication == "com.tencent.mqq") { return(TencentOAuth.HandleOpenURL(url)); } /* * var values = new List<NSObject>(options.Values).Select(x => x.ToString()).ToList(); * if (values.Contains("com.tencent.mqq")) * { * return TencentOAuth.HandleOpenURL(url); * } */ return(base.OpenUrl(app, url, options)); }
public override bool HandleOpenURL(UIApplication application, NSUrl url) { //return base.HandleOpenURL(application, url); return TencentOAuth.HandleOpenURL(url); }
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) { return(TencentOAuth.HandleOpenURL(url)); }
public override bool HandleOpenURL(UIApplication application, NSUrl url) { return(TencentOAuth.HandleOpenURL(url)); }