0

I am trying to add a custom sound to at push notification with PushSharp, but I can't find any documentation about this. I am using a windows service in C#, and every thing worked with default sound. But when I use this code I either get default sound og no sound.

push.QueueNotification(new AppleNotification()                                        
     .ForDeviceToken(deviceToken)                          
     .WithAlert(FormatMatchesMessage(offers))                      
     .WithSound("Jingle.mp3"));

I have the sound file included in the C# project, and also included in the iOS app project.

What do I need to do to make it work? Is it something about filetypes?

4

1 回答 1

0

我从未使用过 PushSharp,但是向推送通知添加声音的正常方法是像您一样简单地指定完整的文件名。您确定声音名称正确且文件在应用程序中可用吗?

您可以尝试通过调用以下方法来安排带有声音的本地推送通知:

+(void)scheduleNotificationForDate:(NSDate*)date withMessage:(NSString*)message andOKButtonTitle:(NSString*)buttonTitle andPayLoad:(NSMutableDictionary*)dic andSoundName:(NSString*)soundName
{
    UILocalNotification *not =[[UILocalNotification alloc] init];
    not.fireDate = date;
    not.alertBody = message;
    not.alertAction = buttonTitle;
    not.soundName = soundName; 
    [[UIApplication sharedApplication] scheduleLocalNotification:not];
}
于 2013-08-20T09:07:16.573 回答