2016-09-29 77 views
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.

哪有我解决这个问题?

+1

那么,你有你'AppDelegate'类另一个'FinishedLaunching'方法?如果是这样,请将其删除。 –

+0

Nikita说什么。很可能你有两个相同方法的定义。 –

+0

是的,我做到了。我没有看到,Xamarin正在使用它。现在我想知道为什么RegisteredForRemoteNotification没有被调用 –

回答

0

对不起,我没看到,Xamarin创造了它自己的FinishedLaunching,当创建项目