Open dukhanov opened 8 years ago
I have actually never used Cordova so I am not sure how that works. First of all, I am not even sure wether or not AppDelegate events are also sent through the NSNotificationCenter, but I have never heard of it before at least.
The delegate callback that you will receive is application:openURL:sourceApplication:annotation: and that is sent to the AppDelegate.
I am sorry that I can't help you much, but I am sure that there must be a way to get the url when using Cordova. Add an NSLog() in the handleOpenURL to see if it is even called or not.
It is not depends on type of your application. We can add this:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:)name:@"flicApp" object:nil];
for example into ViewController method: https://github.com/50ButtonsEach/ios-boilerplate-objc/blob/master/ios-boilerplate-objc/ViewController.m#L30
Anyway, I saw, handleOpenURL was called:
myAppUrl://flicWasGrabbed?data=dc201f9e3d33ff1e2d249678dbe7650a5e91036b42f0ccbe48ff9d1360446615f270880f4ff4e2695f268fd6868aa47b287c92160082190f9657fa1f341153120102000000a4010000720100000000000000463031386358683502e9f1499819f963ce89d1e46c468a13b9341ad4d011a9691198bb6663f61741e44ebdfaca1a41d5d77d501ae8a68dd5de592fadd571153b4a92b5460ab967051fafb8680f1844f12b930b2e660305944ec903a5ad5336ea464446048a5d7ebbd8159e35905d42c8427d840534df29ed4bb296ec35d87b0afe134fa4ed524d81fd84291090d87311f76cbd3cb38b081337ac55bad196a5d84212f96a4f94e5e366181a76e45f115719d4c22368d294ea17e8b70bced545be7cda2b084510490cc413a44cec732d46d87b265cf309af147f6fc348a30948c7215469ff91d0ecc0db8bead7f6c4cbeeb2c91c6a130c543821e3a246d9a31136991408eb86a9744179f384d01ec8ca4a4726f90b922ef4395c80e4da717879&color=7EC250&userAssignedNamed=Greeny
But didReceiveButtonDown
was not called, strange for me, this is why I asked about that.
Oh, well then it should be working. Did you receive the
- (void) flicManager:(SCLFlicManager * _Nonnull) manager didGrabFlicButton:(SCLFlicButton * _Nullable) button withError: (NSError * _Nullable) error;
callback? If so, did you also remember to set the delegate on the button (unless you have not already set the defaultButtonDelegate on the manager) ?
I received Could not grab
message.
I set up defaultButtonDelegate on the manager.
In case I added into appDelegate, it works:
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options;
{
BOOL wasHandled = NO;
wasHandled = [[SCLFlicManager sharedManager] handleOpenURL:url];
return wasHandled;
}
In case I removed application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options
from appDelegate,
and add into viewController:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:)name:@"flicApp" object:nil];
It does not work.
This is fork from yours example project: https://github.com/dukhanov/ios-boilerplate-objc/commit/2d910dd90cadc08b37a9559277b02e94d41b04c4
Very interesting.. I will take a look at this as soon as I have some spare time.
In the meantime, can do you think you can give me the error code that is sent in the didGrabButton callback. This way I might be able to see what the problem is without running your code.
I have checked it again, now it works... It is really strange for me.
I will tune an iOS flic plugin https://github.com/dukhanov/Cordova-Flic for cordova and I will release it asap.
Thanks a lot.
Hello, Will this work, in case I subscribe on event "handleOpenURL", outside of appDelegate.m? For example, I can subscribe on event in cordova plugin:
FlicPlugin.m:
I have done it, and:
Have you tried to subscribe on event "handleOpenURL" outside of appDelegate.m?