Xamarin.IOS 在windows平台下使用VS VPNS注册失败

Pig08 2018-01-18 02:23:30
创建项目使用推送,文档上说明 在ios10版本之后需要使用增强方法,我在FinishedLaunching 方法中加入了


// Register your app for remote notifications.
if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
{
// iOS 10 or later
var authOptions = UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound;
UNUserNotificationCenter.Current.RequestAuthorization(authOptions, (granted, error) =>
{
Console.WriteLine(granted);
});

// For iOS 10 display notification (sent via APNS)
UNUserNotificationCenter.Current.Delegate =new UserNotificationCenterDelegate();

// For iOS 10 data message (sent via FCM)
//Messaging.SharedInstance.RemoteMessageDelegate = this;
}
else
{
// iOS 9 or before
var allNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound;
var settings = UIUserNotificationSettings.GetSettingsForTypes(allNotificationTypes, null);
UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
}

UIApplication.SharedApplication.RegisterForRemoteNotifications();


但是在真机调试的时候总会报错 :未找到应用程序的“aps-environment”的授权字符串

然后我又在文档中看到需要修改配置信息,就做了如下修改
Entitlements.plist在“ 解决方案资源管理器”中双击该文件以打开它进行编辑。
点击+按钮添加一个新的密钥。
输入aps-environment的属性,离开类型为String和Value中输入development:
但是仅仅这样修改之后就在调试的时候app会直接退出来,vs直接停止debug,报出的错误为:Launch failed. The app 'demo.iOS' could not be launched on ‘iphone’。
这样的错误需要怎样的配置
跪求哪位大佬帮给我讲讲如何修改和配置 能完成VPNS的注册和得到deviceToken。 谢谢各位大牛了。
...全文
714 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Pig08 2018-03-28
  • 打赏
  • 举报
回复
引用 1 楼 rye_grass 的回复:
好冷清啊, 在国内用Xamarin的人还不多吧
确实很少 还得靠自己来研究
rye_grass 2018-01-26
  • 打赏
  • 举报
回复
好冷清啊, 在国内用Xamarin的人还不多吧

436

社区成员

发帖
与我相关
我的任务
社区描述
欢迎来到Xamarin技术交流论坛学习交流,Xamarin是一个行动App开发平台,开发人员透过Xamarin可开发出iOS、Android 与Windows 等平台的...
社区管理员
  • Xamarin技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧