0
我試圖按照Azure's guide來設置iOS推送通知。但是,當涉及到第6步,上面寫着AppDelegate已經定義了FinishedLaunching
在
AppDelegate.cs
,更新FinishedLaunching()來匹配 如下:public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) { var pushSettings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, new NSSet()); UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings); UIApplication.SharedApplication.RegisterForRemoteNotifications(); } else { UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound; UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes); } return true; }
我得到這個錯誤Type 'AppDelegate' already defines a member called 'FinishedLaunching' with the same parameter types.
哪有我解決這個問題?
那麼,你有你'AppDelegate'類另一個'FinishedLaunching'方法?如果是這樣,請將其刪除。 –
Nikita說什麼。很可能你有兩個相同方法的定義。 –
是的,我做到了。我沒有看到,Xamarin正在使用它。現在我想知道爲什麼RegisteredForRemoteNotification沒有被調用 –