2017-08-09 6 views
0

xamarin androidのアプリケーションをRedhat Mobile Appsに接続しようとしました。エラーメッセージ "未処理の例外メッセージが発生しました"が表示され続けます。ここでの主なactivtyRedHatMobileAppsのxamarinアプリでFHSDKエラーが発生しました

using System.Collections.Generic; 
using Android.App; 
using Android.Widget; 
using Android.OS; 
using Android.Util; 
using FHSDK; 

namespace helloworld_xamarin 
{ 
    [Activity(Label = "Quickstart HelloWorld", MainLauncher = true, Icon = "@drawable/icon")] 
    public class MainActivity : Activity 
    { 
     private const string Tag = "MainActivity"; 

     protected override async void OnStart() 
     { 
      base.OnStart(); 
      await FHClient.Init(); 
     } 

     protected override void OnCreate(Bundle bundle) 
     { 
      base.OnCreate(bundle); 

      SetContentView(Resource.Layout.Main); 

      var button = FindViewById<Button>(Resource.Id.button); 
      var result = FindViewById<TextView>(Resource.Id.result); 
      var input = FindViewById<EditText>(Resource.Id.helloTo); 
      button.Click += async delegate 
      { 
       result.Text = "Calling Cloud....."; 
       var response = await FH.Cloud("hello", "GET", null, new Dictionary<string, string>() { { "hello", input.Text } }); 
       if (response.Error == null) 
       { 
        Log.Debug(Tag, "cloudCall - success"); 
        result.Text = (string)response.GetResponseAsDictionary()["msg"]; 
       } 
       else 
       { 
        Log.Debug(Tag, "cloudCall - fail"); 
        Log.Error(Tag, response.Error.Message, response.Error); 
        result.Text = response.Error.Message; 
       } 
      }; 
     } 
    } 
} 

は、誰もがモバイルアプリのサービスをREDHATするxamarinモバイルアプリケーションをintergrateする経験を持っているのですか?私は既に私のアプリID、プロジェクトIDなどでfhconfigプロパティを埋めています。あなたの問題は何ですか?私は赤い帽子のモバイルアプリで新しいので、何もありません。

答えて

0

RedHatMobileAppsとの統合を修正する前に、 Rxceptionはです。

"処理されなかった例外が発生しました"は、例外処理が不十分であることを除いては何も教えてくれません。それはそのブロックにasyncブロックがないからです。それはそれをキャッチしていない場合は、

button.Click += async delegate 
{ 
    try { 
     result.Text = "Calling Cloud....."; 
     var response = await FH.Cloud("hello", "GET", null, new Dictionary<string, string>() { { "hello", input.Text } }); 
     if (response.Error == null) 
     { 
      Log.Debug(Tag, "cloudCall - success"); 
      result.Text = (string)response.GetResponseAsDictionary()["msg"]; 
     } 
     else 
     { 
      Log.Debug(Tag, "cloudCall - fail"); 
      Log.Error(Tag, response.Error.Message, response.Error); 
      result.Text = response.Error.Message; 
     } 
    } catch (Exception e) { 
     Android.Util.Log.Error("buttonError", e.Message); 
    } 
}; 

CurrentDomain_UnhandledExceptionと土壇場「キャッチ例外についてのいくつかの情報」タイプのハンドラですAndroidEnvironment_UnhandledExceptionRaiserを見て:

そうにいくつかを追加してみてください。

例外に関する情報がもう少し得られたら、それを追跡するのが簡単になります。

error message

+0

iはbase.on開始()にブレークポイントを追加し、アプリケーションはすぐに「ocured未処理の例外メッセージ」エラーメッセージが表示されます。多分fhsdkのエラーではなく、私のコードですか?あなたはredhatmobileアプリでの経験はありますか? –

+0

- fhsdkを参照している各行をコメントアウトして、次に何が起こるかを確認することができますか? – GregHNZ

+0

誰かがredhatモバイルアプリでの経験を持っている、私を助けてください –

関連する問題