2013-08-20 24 views
0

我试图添加自定义声音来推送通知与PushSharp,但我找不到任何有关此文档。我正在C#中使用Windows服务,并且每件事都使用默认声音。但是当我使用这个代码时,我会得到默认的声音或没有声音。PushSharp iOS PushNotification与自定义声音

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

我有包含在C#项目中的声音文件,也包含在iOS应用程序项目中。

我需要做些什么才能使它工作? 它是关于文件类型的东西吗?

回答

0

我从来没有使用PushSharp,但向Push通知添加声音的正常方式是简单地指定完整的文件名,就像您一样。你确定声音名称是否正确,并且该文件在应用程序中可用?

您可以尝试通过调用的方法等安排与声音本地推送通知:

+(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]; 
} 
+0

我只是去尝试 - 这与本地通知工作。那么问题是什么?我已经验证了这个名字。 –

+0

好吧,这可能是PushSharp的问题。您可以测试另一个推送服务提供商(例如UrbanAirship - 我们对他们的服务非常满意)。 – EsbenB

+0

嗯..当我在本地通知测试后再次尝试时,它也可以工作 - 也可以在其他设备上使用。 –