我正在Xamarin应用程序项目的iOS项目中使用此方法向Azure的通知中心注册以进行开发(将集线器和应用程序配置为通过证书开发并在Apple开发人员门户上进行配置,即entitlements.plist中的关键字设置为开发人员,中心已上传了p12开发人员证书)。
[此方法(以及相应的应用程序)在开发模式下的iPhone 5S上运行良好。
但是在我的iPhone 8 Plus上却出现此错误:
=================================================================
Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
=================================================================
Native stacktrace:
=================================================================
0x103ef09c8 - /private/var/containers/Bundle/Application/10179C87-9D6C-4E2B-90AD-
57BF86C9C934/myapp.iOS.app/myapp.iOS : (null)
0x103ee67b0 - /private/var/containers/Bundle/Application/10179C87-9D6C-4E2B-90AD-
57BF86C9C934/myapp.iOS.app/myapp.iOS : (null)
0x103ef4ff0 - /private/var/containers/Bundle/Application/10179C87-9D6C-4E2B-90AD-
57BF86C9C934/myapp.iOS.app/myapp.iOS : mono_pmip
0x195cdf894 - /usr/lib/system/libsystem_platform.dylib : <redacted>
0x10214029c - /private/var/containers/Bundle/Applica
tion/10179C87-9D6C-4E2B-90AD-57BF86C9C934/ShakeAlarmRR1.iOS.app/ShakeAlarmRR1.iOS : (null)
0x1021403fc - /private/var/containers/Bundle/Application/10179C87-9D6C-4E2B-90AD-
57BF86C9C934/myapp.iOS.app/myapp.iOS : (null)
0x102147ff8 - /private/var/containers/Bundle/Application/10179C87-9D6C-4E2B-90AD-
57BF86C9C934/myapp.iOS.app/myapp.iOS : (null)
0x102147b38 - /private/var/containers/Bundle/Application/10179C87-9D6C-4E2B-90AD-
57BF86C9C934/myapp.iOS.app/myapp.iOS : (null)
0x102146364 - /private/var/containers/Bundle/Application/10179C87-9D6C-4E2B-90AD-
57BF86C9C934/myapp.iOS.app/myapp.iOS : (null)
0x102145768 - /private/var/containers/Bundle/Application/10179C87-9D6C-4E2B-90AD-
57BF86C9C934/myapp.iOS.app/myapp.iOS : (null)
0x102144620 - /private/var/containers/Bundle/Application/10179C87-9D6C-4E2B-90AD-
57BF86C9C934/myapp.iOS.app/myapp.iOS : (null)
0x1963b90b0 - /System/Library/Frameworks/Foundation.framework/Foundation : <redacted>
0x195ced1ec - /usr/lib/system/libsystem_pthread.dylib : _pthread_start
0x195cf0aec - /usr/lib/system/libsystem_pthread.dylib : thread_start
=================================================================
Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x195cdef44):0x195cdef34 c0 03 5f d6 1f 20 03 d5 1f 20 03
d5 01 ec 7c 92 .._.. ... ....|.
0x195cdef44 20 00 c0 3d c3 f9 ff 10 62 04 c1 3c 02 0c 40 92 ..
=....b..<..@.
0x195cdef54 63 00 02 cb 61 00 c0 3d 00 1c a1 4e 05 00 00 14 c...a..=...N....
0x195cdef64 1f 20 03 d5 1f 20 03 d5 1f 20 03 d5 20 0c c1 3c . ... ... .. ..<
在AppDelegate.cs中:
public override void RegisteredForRemoteNotifications(
UIApplication application, NSData deviceToken)
{
AzureNotifHub = new SBNotificationHub(AppConstants.AZURE_DEVNOTIFHUB3_LISTENSHARED,
AppConstants.DEV_NOTIFHUB3);
// update registration with Azure Notification Hub
AzureNotifHub.UnregisterAllAsync(deviceToken, (error) =>
{
if (error != null)
{
Debug.WriteLine($"Unable to call unregister {error}");
return;
}
var tags = new NSSet(AppConstants.IOSSUBSCRIPTIONTAGS.ToArray());
AzureNotifHub.RegisterNativeAsync(deviceToken, tags, (errorCallback) =>
{
if (errorCallback != null)
{
Debug.WriteLine($"RegisterNativeAsync error: {errorCallback}");
}
});
var templateExpiration =
DateTime.Now.AddDays(120).ToString(System.Globalization.CultureInfo.CreateSpecificCulture("en-
US"));
AzureNotifHub.RegisterTemplateAsync(deviceToken, "defaultTemplate",
AppConstants.IOS_APNS_TEMPLATE_BODY, templateExpiration, tags, (errorCallback) =>
{
if (errorCallback != null)
{
if (errorCallback != null)
{
Debug.WriteLine($"RegisterTemplateAsync error: {errorCallback}");
}
}
});
});
我现在正在开发模式下使用iPhone 8 Plus。该设备已从应用商店下载了该应用,因此先前已在生产模式下向通知中心注册,不知道这是否与它有关。
也正在使用BETA ios 13操作系统。
什么可能导致此错误以及如何解决?
该问题似乎是由于this造成的