diff --git a/Monal/Classes/MLXMPPManager.h b/Monal/Classes/MLXMPPManager.h index b3a3ddacf3..5ea21f30d8 100644 --- a/Monal/Classes/MLXMPPManager.h +++ b/Monal/Classes/MLXMPPManager.h @@ -110,6 +110,7 @@ Sends a message to a specified contact in account. Calls completion handler on s @property (nonatomic, assign) BOOL hasAPNSToken; @property (nonatomic, strong) NSString* pushToken; +@property (nonatomic, strong) NSError* _Nullable apnsError; @property (nonatomic, readonly) BOOL isBackgrounded; @property (nonatomic, readonly) BOOL isNotInFocus; diff --git a/Monal/Classes/MonalAppDelegate.m b/Monal/Classes/MonalAppDelegate.m index f1995d26ae..4d5045f45f 100644 --- a/Monal/Classes/MonalAppDelegate.m +++ b/Monal/Classes/MonalAppDelegate.m @@ -318,6 +318,7 @@ -(void) application:(UIApplication*) application didFailToRegisterForRemoteNotif { DDLogError(@"APNS push reg error %@", error); [[MLXMPPManager sharedInstance] removeToken]; + [MLXMPPManager sharedInstance].apnsError = error; } #pragma mark - notification actions diff --git a/Monal/Classes/NotificationSettings.swift b/Monal/Classes/NotificationSettings.swift index 317c86377a..42e3135967 100644 --- a/Monal/Classes/NotificationSettings.swift +++ b/Monal/Classes/NotificationSettings.swift @@ -49,6 +49,9 @@ struct NotificationSettings: View { buildLabel(Text("Apple Push Service"), isWorking: self.applePushEnabled); Divider() Text("Apple push service should always be on. If it is off, your device can not talk to Apple's server.").font(.footnote) + if !self.applePushEnabled, let apnsError = MLXMPPManager.sharedInstance().apnsError { + Text("Error: \(String(describing:apnsError))").foregroundColor(.red).font(.footnote) + } }.onTapGesture(count: 2, perform: { showPushToken = true }).alert(isPresented: $showPushToken) {