Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 发出本地警报通知_Ios_Xamarin_Notifications_Push Notification_Alert - Fatal编程技术网

Ios 发出本地警报通知

Ios 发出本地警报通知,ios,xamarin,notifications,push-notification,alert,Ios,Xamarin,Notifications,Push Notification,Alert,我正在使用Xamarin和iOS,但在通知方面我遇到了很多麻烦。我可以创建一个到通知中心的本地推送通知,但没有声音或指示通知实际到达。如何使通知成为警报通知,使其在转到通知中心之前显示在屏幕上 以下是我当前生成通知时使用的代码: //create notification var notification = new UILocalNotification (); notification.AlertAction = "Open App"; notification.AlertTitle = "

我正在使用Xamarin和iOS,但在通知方面我遇到了很多麻烦。我可以创建一个到通知中心的本地推送通知,但没有声音或指示通知实际到达。如何使通知成为警报通知,使其在转到通知中心之前显示在屏幕上

以下是我当前生成通知时使用的代码:

//create notification
var notification = new UILocalNotification ();
notification.AlertAction = "Open App";
notification.AlertTitle = "App";
notification.AlertBody = "There has been activity in the app";
notification.SoundName = UILocalNotification.DefaultSoundName;

//display notification
UIApplication.SharedApplication.ScheduleLocalNotification (notification);
编辑: 问题不仅在于声音,还在于没有收到警报的反馈,它只是静静地出现在通知中心。我正在请求此代码的权限:

var settings = UIUserNotificationSettings.GetSettingsForTypes(
                UIUserNotificationType.Alert
                | UIUserNotificationType.Badge
                | UIUserNotificationType.Sound,
                new NSSet());

            UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
            UIApplication.SharedApplication.RegisterForRemoteNotifications();
使用 [通知setSoundName:UILocalNotificationDefaultSoundName]; 它会很好用的。

使用 [通知setSoundName:UILocalNotificationDefaultSoundName];
它可以正常工作。

所以唯一的问题是声音?如果是,请检查通知权限如果声音被任何机会禁用我更新了问题,问题不仅仅是声音。您的更新没有改变我的建议,您是否检查了您是否激活了权限?因此,唯一的问题是声音?如果是,请检查通知权限如果声音因任何原因被禁用我更新了问题,问题不仅仅在于声音。您的更新没有改变我的建议,您是否检查了您是否激活了权限?