2016-04-15 87 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处理它

相关问题