2014-09-11 94 views
0

如果有人在其iPhone上安裝了星巴克應用程序,您會看到在星巴克中或附近的星巴克上,您的鎖定屏幕上有一種推送通知,並且您將其滑開立即啓動應用程序,就像鎖定屏幕上的文本消息一樣。我想知道這是否是一項艱鉅的任務要完成,並且基於它的位置的外觀,所以如果我靠近某個地方,它會顯示在我的主屏幕上。他們是這個名字嗎?這太難了嗎?謝謝。目標C-從主屏幕滑動打開應用程序

回答

1

如果我正確理解你的問題,你需要使用通知。閱讀documentation,您將瞭解如何使用它。

這是一個示範如何對特定的時間間隔後觸發一個本地通知:

- (void) scheduleLocalNotificationWithMessage:(NSString*) msg andFireTime:(NSTimeInterval) time 
{ 
    UILocalNotification *notification = [[UILocalNotification alloc] init]; 
    notification.fireDate = [NSDate dateWithTimeIntervalSinceNow:time]; 
    notification.alertBody = msg; 
    notification.soundName = UILocalNotificationDefaultSoundName; 
    [[UIApplication sharedApplication] scheduleLocalNotification:notification]; 
} 

爲了獲得永久位置更新,this教程將幫助您。

接收位置更新,在後臺應用程序中選擇目標,然後選擇功能,然後檢查位置更新: enter image description here

祝你好運!

+2

+1,OP還需要使用'後臺應用程序刷新'來監視設備的位置 – Shai 2014-09-11 13:11:34

相關問題