2013-08-20 25 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

嗯..當我在本地通知測試後再次嘗試時,它也可以工作 - 也可以在其他設備上使用。 –