urbanairship / urbanairship-xamarin

Urban Airship Xamarin Libraries
https://docs.urbanairship.com/platform/xamarin/
Apache License 2.0
9 stars 5 forks source link

Custom Action for Deep Link #73

Closed samshiffman321 closed 7 years ago

samshiffman321 commented 7 years ago

I am attempting to follow along with the example found at (https://docs.urbanairship.com/guides/ios-deep-linking/#customizing-the-deep-link-action) and I cannot find a constant in the Xamarin component/nuget package that corresponds to the constant "kUADeepLinkActionDefaultRegistryName".

It seems there should be a similar constant in the Xamarin project, but if there is there is no public access to it.

marc-scig commented 7 years ago

HI there,

You're right, it looks as though the action name constants are not in the binding. My guess is that the tool we're using to generate bindings doesn't include preprocessor macros, which is how these are defined in the SDK.

As a workaround for now you can try using the literal name, "deep_link_action", which is unlikely to go away any time soon.

samshiffman321 commented 7 years ago

@marc-scig I have tried using the string directly, and when I do that I receive the following error when attempting to open my app from a push notification:

Attempting to JIT compile method '(wrapper managed-to-native) UrbanAirship.UAActionCompletionHandler:wrapper_aot_native (object,UrbanAirship.UAActionResult)' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information.

It seems to me that there is something weird going on in the UAActionCompletionHandler that the Xamarin compiler isn't able to handle. I am using Visual Studio 7.1.5 (build 2) with Xamarin.iOS 11.

This is the code I have set up in my AppDelegate to do the custom action: //custom action UAAction deepLinkAction = UAAction.Action(HandleUAActionBlock); UAirship.Shared.ActionRegistry.UpdateAction(deepLinkAction, "deep_link_action");

and void HandleUAActionBlock(UAActionArguments args, UAActionCompletionHandler completion) { completion.Invoke(UAActionResult.EmptyResult()); }

rlepinski commented 7 years ago

@samshiffman321 We are looking into it

BrianBatchelder commented 7 years ago

@samshiffman321 We discovered the problem. It is a binding issue in ApiDefinition.cs. We will release a new version with the fix on Monday.

BrianBatchelder commented 7 years ago

@samshiffman321 We have released version 4.6.1 to address the run-time exception. Let us know if you have any further issues.