AppDelegate已经定义了FinishedLaunching

时间:2016-09-29 10:38:38

标签: c# ios azure xamarin.ios azure-notificationhub

我正在尝试关注Azure's guide来设置iOS推送通知。但是当谈到第6步时,就说

  

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.

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

对不起,我没有看到,Xamarin在项目创建时创建了自己的FinishedLaunching