このコードを使用して、Json テキストを取得します。
response = await _httpClient.GetAsync(Gurl).ConfigureAwait(false);
ガールが正しい。これは、IOS シミュレーターでは正常に機能しますが、Android では機能しません。
Android では、次のようにページを呼び出すと機能します。
Navigation.PushModalAsync(new NavigationPage(new Gallery()));
またはこのように:
Navigation.PushAsync(new NavigationPage(new Gallery()));
次のようにページを呼び出すと機能しません。
Navigation.PushAsync(new Gallery());
IOS では、3 つすべてが機能します。しかし、IOS で [戻る] ボタンを使用するには、非モーダルにする必要があります。
私が得るエラーは次のとおりです。
The application is in break mode
Your app has entered a break state, but there is no code to show because all threads were executing external code (typically system or framework code).
System.NullReferenceException: 'Object reference not set to an instance of an object.'
継続しない場所が見つかるまでブレークポイントを追加することで、問題を引き起こしている行を見つけました。
呼び出しスタックはのみ[external code]
を言い、出力はこれを言います:
04-02 20:50:16.957 D/Mono ( 4825): Requesting loading reference 1 (of 3) of System.Net.Http.dll
04-02 20:50:16.957 D/Mono ( 4825): Loading reference 1 of System.Net.Http.dll asmctx DEFAULT, looking for System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
04-02 20:50:16.957 D/Mono ( 4825): Assembly Ref addref System.Net.Http[0xcc240e40] -> System[0xe78226a0]: 13
04-02 20:50:16.963 D/Mono ( 4825): Requesting loading reference 2 (of 8) of Mono.Android.dll
04-02 20:50:16.963 D/Mono ( 4825): Loading reference 2 of Mono.Android.dll asmctx DEFAULT, looking for System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
04-02 20:50:16.964 D/Mono ( 4825): Assembly Ref addref Mono.Android[0xe7822580] -> System.Net.Http[0xcc240e40]: 3
[0:] Binding: 'isBusy' property not found on 'GalShare.ViewModel.GalleryViewModel', target property: 'Xamarin.Forms.StackLayout.IsVisible'
04-02 20:50:17.118 W/nyname.galshar( 4825): Accessing hidden field Landroid/view/animation/Animation;->mListener:Landroid/view/animation/Animation$AnimationListener; (light greylist, reflection)
04-02 20:50:17.136 W/nyname.galshar( 4825): JNI RegisterNativeMethods: attempt to register 0 native methods for crc643f46942d9dd1fff9.ActivityIndicatorRenderer
04-02 20:50:17.282 D/NetworkSecurityConfig( 4825): No Network Security Config specified, using platform default
Thread started: <Thread Pool> #9
**System.NullReferenceException:** 'Object reference not set to an instance of an object.'