2011-09-13 119 views
0

推送通知中只顯示徽章和聲音我正在使用推送通知通知用戶他們有一條新消息。當新消息沒有提示消息時,是否可以僅顯示徽章和聲音?蘋果是否允許使用這種通知。如果是的話,任何一種我可以如何繼續下去。是否有可能在iPhone

在此先感謝

回答

1

確定您只能顯示徽章和聲音。 爲此,您需要做的是: -

,你已經設置的通知類型的寫: -

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeSound|UIRemoteNotificationTypeBadge)]; 

不添加警報通知。

+0

我希望你已經整理出來了。 – Gypsa

0

僅通知聲音和批次的詳細信息不提供警報通知。

-(void) scheduleNotificationForDate: (NSDate*)date { 
    [[UIApplication sharedApplication] cancelAllLocalNotifications]; 
    UILocalNotification *localNotification = [[UILocalNotification alloc] init]; 
    localNotification.fireDate = date; 
    NSLog(@"Notification will be shown on: %@",localNotification.fireDate); 
    localNotification.timeZone = [NSTimeZone defaultTimeZone]; 
    localNotification.soundName = UILocalNotificationDefaultSoundName; 
    localNotification.applicationIconBadgeNumber = 1; 
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification]; 
    }