In IOS I have this function :
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
my particular problem is this param :
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
i translate it like
procedure userNotificationCenterWillPresentNotificationWithCompletionHandler(center: UNUserNotificationCenter;
willPresentNotification: UNNotification;
withCompletionHandler: pointer);
var aImp: procedure(self: pointer; _cmd: pointer; const options); cdecl;
aOptions: UNNotificationPresentationOptions;
begin
@aImp := imp_implementationWithBlock(withCompletionHandler);
aOptions := UNNotificationPresentationOptionAlert;
aImp(self, nil, aOptions);
imp_removeBlock(@aImp);
end;
but it's not work ! i thing i do something wrong when passing the options
i declare the imp function like
var aImp: procedure(self: pointer; _cmd: pointer; const options); cdecl;
aOptions := UNNotificationPresentationOptionAlert;
but maybe not the good way, i try to declare it like
var aImp: procedure(self: pointer; _cmd: pointer; options: pointer); cdecl;
aOptions := pointer(UNNotificationPresentationOptionAlert);
or like
var aImp: procedure(self: pointer; _cmd: pointer; options: nsuinteger); cdecl;
aOptions := UNNotificationPresentationOptionAlert;
none work :( any idea(s) of what I miss ?