德尔福 - 应用程序运行时处理推送通知?
问题描述:
这是我们如何处理他们在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
?
答
注:可悲的是,我不能在此刻与我测试这个,因为我没有在Mac但这应该工作
里面FMX.Platform.iOS
你会发现
ApplicationDidReceiveRemoteNotification
方法,所以它在德尔福实施
procedure TApplicationDelegate.applicationDidReceiveRemoteNotification(
Sender: UIApplication; ANotification: NSDictionary);
begin
PlatformCocoa.ReceivedRemoteNotification(ANotification);
end;
在那里你可以得到通知为NSDictionary
你可以母鸡从NSDictionary
读出的值来处理它,你想办法
您也可以参考雷米的answer关于方法混写告诉应用程序来,而使用你的ApplicationDidReceiveRemoteNotification
版本,而不是一个对我的一个问题在源
答
的iOS仅
掉落形式
掉落形式
绑定上的TPushEvents
组件上的TEMSProvider
部件到TEMSProvider
某处设置TPushEvents.Active := True
或启用它的AutoActivate属性
TPushEvents有一个事件称为PushEvents1PushReceived
处理它
你应该改变你的问题的标题包括德尔福10西雅图。它目前太过误导 – Gruntcakes
@SausageMachine完成了。我将把它作为Delphi离开,所以它不会局限于它的最后一个版本。 – Machado
@SausageMachine,这就是标签的用途。 – Johan