class_addMethod
学习FMX.Platform.iOS.pas文件的处理办法
d:\program files (x86)\embarcadero\studio\17.0\source\fmx\FMX.Platform.iOS.pas
performFetchWithCompletionHandler
procedure performFetchWithCompletionHandler(self : id; _cmd : SEL; application: PUIApplication; handler : id );
var
ahandlerimp: IMP;
begin
//Code to perform fetch HERE!!!!
fecth_string_test := 'entered background code!!'; ahandlerimp := imp_implementationWithBlock( handler ); //Create c function for block
ahandlerimp(self,_cmd, UIBackgroundFetchResultNewData); //Call c function, _cmd is ignored
imp_removeBlock(ahandlerimp); //Remove the c function created two lines up
end;
class_addMethod(objc_getClass('DelphiAppDelegate') ,
sel_getUid('application:performFetchWithCompletionHandler:'),
@performFetchWithCompletionHandler,
'v@:@?');
applicationDidReceiveLocalNotification
procedure applicationDidReceiveLocalNotification(self: id; _cmd: SEL;
application: PUIApplication; notification: Pointer);
begin
ShowMessage('it works');
end;
class_addMethod(objc_getClass('DelphiAppDelegate'), sel_getUid('application:didReceiveLocalNotification:'),
@applicationDidReceiveLocalNotification, 'v@:@@');