0

すべてが正しく設定されているように見えます。私は何度もそれを超えてきました。ここで私が得たものです:私は接続したときに私のXamarin iOS AppでNotifcationHubメッセージが機能しない

サービスバスExplorerはこれを返します。すべてのケースで

<23:36:44> The application is now connected to the 

sb://localesnotify.servicebus.windows.net/ service bus namespace. 
<23:36:44> MessagingFactory successfully created 
<23:37:24> Exception: The remote server returned an error: (500) Internal Server Error. TrackingId:20b6388b-2599-428a-a7b8-2c81eba6b309,TimeStamp:3/4/2017 4:37:24 AM 
<23:37:24> InnerException: The remote server returned an error: (500) Internal Server Error 

を、私は私のデバイス上でテストするとき、RegisteredForRemoteNotificationsが正常に戻ります。

public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken) 
    { 
     Hub = new SBNotificationHub(Constants.ConnectionString, Constants.NotificationHubPath); 

     Hub.UnregisterAllAsync(deviceToken, (error) => { 
      if (error != null) 
      { 
       Console.WriteLine("Error calling Unregister: {0}", error.ToString()); 
       return; 
      } 

      NSSet tags = null; // create tags if you want 
      Hub.RegisterNativeAsync(deviceToken, tags, (errorCallback) => { 
       if (errorCallback != null) 
        Console.WriteLine("RegisterNativeAsync error: " + errorCallback.ToString()); 
      }); 
     }); 

     var alert = new UIAlertView("Remote Notifications", "Registered!", null, "OK", null); 

     alert.Show(); 
    } 

私の証明書とプロビジョニングプロファイルが正常に両方のAzure & Xamarinに設定されたようです。

私はさまざまな接続文字列と通知ハブのURLを試しました。どちらが使えるかわからないしかし、私はすべてのことを考えました。

// Azure app-specific connection string and hub path 
    public const string ConnectionString = "Endpoint=sb://localesnotify.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=1QMNeVitGRUxoZvkgnx8klpJGsJ5LfX/057jL+CD2VE="; 
    public const string NotificationHubPath = "sb://localesnotify.servicebus.windows.net"; 

私がAzureからの送信をテストすると、正常に完了したと表示されますが、メッセージは表示されません。

My ReceivedRemoteNotificationは起動しません。だから私のクライアントは正しく接続されていないと思います。また、Classicポータルでは、選択されたプラットフォームの登録が見つかりませんでした。

 public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo) 
    { 
     ProcessNotification(userInfo, false); 
    } 

+0

「NoficationHubPath」を、Azureでハブの名前だけに変更します。 – apineda

+0

私はいくつかの選択肢があります。これは古典的なポータルからのものです:https://localesnotify.servicebus.windows.net/localesnotify。これは、新しいポータルからのものです。 サービスエンドポイント https://LocalesNotify.servicebus.windows.net:443/です。これはAppサービスです。http://locales.azurewebsites.net/ – Spinteractive

+0

URLは単なる名前ではありません。紺碧では、これがオブジェクトの名前になります。アイコンは通常オレンジ色です。 – apineda

答えて

1

NotificationHubPathをAzureのハブの名前に変更します。

それはアズールにログインしてNotificationHubオブジェクトをクリックして検索するには:

Azure notification hub

は、[プロパティ]オプションとコピー を選択します。

Notification Hub properties

これはSBNotificationHubコンストラクタでnotificationHubPathとして使用する値です。

var hub = new SBNotificationHub ("azureKey", "yournotificationhub"); 

注:タイプそれはすべて小文字。

関連する問題