2016-04-15 102 views
0

這是我們如何處理他們在XCode德爾福 - 應用程序運行時處理推送通知?

- (void)application:(UIApplication *)application 
    didReceiveRemoteNotification:(NSDictionary *)userInfo 
{ 
    NSString *message = nil; 
    id alert = [userInfo objectForKey:@"alert"]; 
    if ([alert isKindOfClass:[NSString class]]) { 
    message = alert; 
    } else if ([alert isKindOfClass:[NSDictionary class]]) { 
    message = [alert objectForKey:@"body"]; 
    } 
    if (alert) { 
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Title" 
             message:@"AThe message." delegate:self 
          cancelButtonTitle:@"button 1" 
          otherButtonTitles:@"button", nil]; 
    [alertView show]; 
    [alertView release]; 
    } 

我們如何趕上推送通知,如果iOS應用在以同樣的方式已經運行,但使用Delphi 10 Seattle

+0

你應該改變你的問題的標題包括德爾福10西雅圖。它目前太過誤導 – Gruntcakes

+0

@SausageMachine完成了。我將把它作爲Delphi離開,所以它不會侷限於它的最後一個版本。 – Machado

+0

@SausageMachine,這就是標籤的用途。 – Johan

回答

0

:可悲的是,我不能在此刻與我測試這個,因爲我沒有在Mac但這應該工作

裏面FMX.Platform.iOS你會發現

ApplicationDidReceiveRemoteNotification 

方法,所以它在德爾福實施

procedure TApplicationDelegate.applicationDidReceiveRemoteNotification(
    Sender: UIApplication; ANotification: NSDictionary); 
begin 
    PlatformCocoa.ReceivedRemoteNotification(ANotification); 
end; 

在那裏你可以得到通知爲NSDictionary你可以母雞從NSDictionary讀出的值來處理它,你想辦法

您也可以參考雷米的answer關於方法混寫告訴應用程序來,而使用你的ApplicationDidReceiveRemoteNotification版本,而不是一個對我的一個問題在源

0

的iOS僅

掉落形式
掉落形式
綁定上的TPushEvents組件上的TEMSProvider部件到TEMSProvider

代碼

某處設置TPushEvents.Active := True或啓用它的AutoActivate屬性

TPushEvents有一個事件稱爲PushEvents1PushReceived處理它

相關問題