【发布时间】:2014-04-17 10:26:20
【问题描述】:
我正在尝试在我的 firemonkey 应用程序中进行后台提取工作。
到目前为止,我的 perfromFetchWithCompletionHandler 被调用并下载新信息。
当我完成 fetch 并需要调用 completionHandler 代码块时,问题就出现了,应用程序挂起并且我没有收到任何异常(至少我可以读取)
设置:
TBackgroundFetchResultHandlerC = procedure ( AResult : NSUInteger ); cdecl;
..
..
procedure performFetchWithCompletionHandler(self : id; _cmd : SEL; application: PUIApplication; handler : TBackgroundFetchResultHandlerC );
..
..
objc_msgSend((UIApp as ILocalObject).GetObjectId,
sel_getUid('setMinimumBackgroundFetchInterval:'),
Interval);
class_addMethod( objc_getClass('DelphiAppDelegate') ,
sel_getUid('application:performFetchWithCompletionHandler:'),
@performFetchWithCompletionHandler,
'v@:@?'
);
..
..
procedure performFetchWithCompletionHandler(self : id; _cmd : SEL; application: PUIApplication; handler : TBackgroundFetchResultHandlerC );
var t : TThread;
begin
NSLog3('performFetchWithCompletionHandler:begin');
Handler(0); <<--Stops here
//Next line of code never gets called.
NSLog3(Format('performFetchWithCompletionHandler:done, done',[ FetchResult ]) );
end;
performFetchWithCompletionHandler man page
我尝试过使用不同的函数指针类型声明,但由于它不是函数指针,我想这就是它不起作用的原因。
有什么想法吗?
谢谢 罗伯特
【问题讨论】:
-
你知道source\rtl\osx\Macapi.OCBlocks.pas 文件吗?
-
不,我不知道。我去看看,谢谢!
标签: ios delphi objective-c-blocks firemonkey