I have the following code in a project I am working on, but for some reason the raiseEvent method is not being triggered, I can see the methods inside this inline code working as I can see the logs from each method, What is the correct format for the raiseEvent function?
And this is how that inline objective C code is being used in my project
Any suggestions?
Walter
configureRemoteCommandCenter:
@end
@interface RemoteCommandCenterHelper : NSObject
+ (void)configureRemoteCommandCenter;
@end
@implementation RemoteCommandCenterHelper
+ (void)configureRemoteCommandCenter {
MPRemoteCommandCenter *center = [MPRemoteCommandCenter sharedCommandCenter];
NSLog(@"Configuring Remote Command Center");
[center.playCommand addTarget:self action:@selector(play)];
[center.pauseCommand addTarget:self action:@selector(pause)];
center.playCommand.enabled = YES;
center.pauseCommand.enabled = YES;
}
+ (MPRemoteCommandHandlerStatus)play {
NSLog(@"Play command received");
[B4IObjectWrapper raiseEvent:self :@"controlevent:" :@[@"play"]];
return MPRemoteCommandHandlerStatusSuccess;
}
+ (MPRemoteCommandHandlerStatus)pause {
NSLog(@"Pause command received");
[B4IObjectWrapper raiseEvent:self :@"controlevent:" :@[@"pause"]];
return MPRemoteCommandHandlerStatusSuccess;
}
And this is how that inline objective C code is being used in my project
B4X:
Sub ConfigureRemoteCommandCenter
Dim remoteCommandCenterHelper As NativeObject = Me
remoteCommandCenterHelper.Initialize("RemoteCommandCenterHelper").RunMethod("new", Null)
remoteCommandCenterHelper.RunMethod("configureRemoteCommandCenter", Null)
End Sub
Any suggestions?
Walter