amazon-archives / aws-sdk-xamarin

AWS Mobile SDK for Xamarin (Beta)
Apache License 2.0
45 stars 18 forks source link

RegionEndPoint null reference #23

Closed luispedrofonseca closed 9 years ago

luispedrofonseca commented 9 years ago

I'm having an issue trying to use the SimpleNotificationSystem where the RegionEndPoint is null.

public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            var oldDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken");
            var newDeviceToken = deviceToken.ToString().Replace("<", "").Replace(">", "").Replace(" ", "");

            if (string.IsNullOrEmpty(oldDeviceToken) || !oldDeviceToken.Equals(newDeviceToken))
            {
                var platformEndPointRequest = new CreatePlatformEndpointRequest();
                platformEndPointRequest.Token = newDeviceToken;
                platformEndPointRequest.PlatformApplicationArn = "*";

                var cred = new BasicAWSCredentials(AppSettings.AMAZON_SNS_ACCESS_KEY, AppSettings.AMAZON_SNS_SECRET_KEY);

                var snsClient = new AmazonSimpleNotificationServiceClient(cred, Amazon.RegionEndpoint.USWest2);

                snsClient.CreatePlatformEndpointAsync(platformEndPointRequest);
            }

            NSUserDefaults.StandardUserDefaults.SetString(newDeviceToken, "PushDeviceToken");
        }

This is the code I'm using on my AppDelegate and here's the stack trace:

screenshot 2015-04-24 19 53 32

Any idea of what I might be doing wrong or is this a problem with the SDK?

rjcollingham commented 9 years ago

See this issue which is closed but not yet solved...there is a missing file in the iOS DLL

https://github.com/awslabs/aws-sdk-xamarin/issues/20