我们已经在xamarin应用程序中使用了Azure SDK。 当我们使用Google或Facebook在我们的应用程序中使用Azure登录,然后使用应用程序内购买进行订阅时,应用程序在iOS中崩溃。
打开“在应用内购买”对话框后,应用将崩溃。
此外,在安装应用后首次进行订阅时会崩溃。然后一切正常。
请在下面查看详细的错误日志。
2019-02-08 17:19:59.065 EarnieJr.iOS[4133:1596190] [AppCenterCrashes] ERROR: +[MSWrapperLogger MSWrapperLog:tag:level:]/7 Unhandled Exception:
UIKit.UIKitThreadAccessException: UIKit Consistency error: you are calling a UIKit method that can only be invoked from the UI thread.
at UIKit.UIApplication.EnsureUIThread () [0x00020] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIApplication.cs:89
at UIKit.UIControl.RemoveTarget (Foundation.NSObject target, System.IntPtr sel, UIKit.UIControlEvent events) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIControl.g.cs:235
at UIKit.UIControl.RemoveTarget (System.EventHandler notification, UIKit.UIControlEvent events) [0x00048] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIControl.cs:116
at UIKit.UIControl.remove_TouchUpInside (System.EventHandler value) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIControl.cs:182
at Xamarin.Forms.Platform.iOS.ButtonRenderer.Dispose (System.Boolean disposing) [0x00017] in <55e20ffeeae44e4d8fcf262393127192>:0
at Foundation.NSObject.Finalize () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/Foundation/NSObject2.cs:143
2019-02-08 17:19:59.072 EarnieJr.iOS[4133:1596190] [AppCenterCrashes] WARNING: +[MSWrapperLogger MSWrapperLog:tag:level:]/7 Cannot serialize UIKit.UIKitThreadAccessException exception for client side inspection. If you want to have access to the exception in the callbacks, please add a Serializable attribute and a deserialization constructor to the exception class.
2019-02-08 17:19:59.082 EarnieJr.iOS[4133:1596190] Unhandled managed exception:
UIKit Consistency error: you are calling a UIKit method that can only be invoked from the UI thread. (UIKit.UIKitThreadAccessException)
at UIKit.UIApplication.EnsureUIThread () [0x00020] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIApplication.cs:89
at UIKit.UIControl.RemoveTarget (Foundation.NSObject target, System.IntPtr sel, UIKit.UIControlEvent events) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIControl.g.cs:235
at UIKit.UIControl.RemoveTarget (System.EventHandler notification, UIKit.UIControlEvent events) [0x00048] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIControl.cs:116
at UIKit.UIControl.remove_TouchUpInside (System.EventHandler value) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIControl.cs:182
at Xamarin.Forms.Platform.iOS.ButtonRenderer.Dispose (System.Boolean disposing) [0x00017] in <55e20ffeeae44e4d8fcf262393127192>:0
at Foundation.NSObject.Finalize () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/Foundation/NSObject2.cs:143
版本详细信息如下所示,用于已使用的软件包,
“ Microsoft.Azure.Mobile.Client” Version =“ 4.1.1”
“ Plugin.InAppBilling” Version =“ 2.0.0”
“ Xamarin.Forms” Version =“ 3.5.0.129452”
var billing = CrossInAppBilling.Current; var Purchase = await billing.PurchaseAsync(“ ProductId here”,ItemType.Subscription,“ devId”);