2013-11-04 29 views
1

我正在開發一個應用程序,其中必須觸發本地通知,當變量值爲f.x時。上述40如何在xcode中創建本地通知?

我想使用:

If(Myvalue > 40) { 
    Notification triggers 
} 

但我不知道如何觸發通知。

你能幫我嗎?

+0

@mah,OP是詢問UILocalNotification,而不是如何使用通知從應用程序內。 –

+0

@DanFairaizl謝謝你指出我。 – mah

回答

0

類似下面應該讓你開始使用UILocalNotification

UILocalNotification *localNotif = [[UILocalNotification alloc] init]; 

localNotif.fireDate = [NSDate date]; 

localNotif.alertBody = @"Message body" 
localNotif.alertAction = @"View Details"; 

localNotif.soundName = UILocalNotificationDefaultSoundName; 
localNotif.applicationIconBadgeNumber = 1; 

[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];