Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More helpful error messages for p12 password and device token on iOS app #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Touch/NWAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ - (void)loadCertificate

NSArray *ids = [NWSecTools identitiesWithPKCS12Data:pkcs12 password:pkcs12Password error:&error];
if (!ids) {
NWLogWarn(@"Unable to read p12 file: %@", error.localizedDescription);
if (error.code == kNWErrorPKCS12AuthFailed) {
NWLogWarn(@"%@: Set pkcs12Password in NWAppDelegate.", error.localizedDescription);
} else {
NWLogWarn(@"Unable to read p12 file: %@", error.localizedDescription);
}
return;
}
for (NWIdentityRef identity in ids) {
Expand Down Expand Up @@ -198,7 +202,11 @@ - (void)notification:(NWNotification *)notification didFailWithError:(NSError *)
{
dispatch_async(dispatch_get_main_queue(), ^{
//NSLog(@"failed notification: %@ %@ %lu %lu %lu", notification.payload, notification.token, notification.identifier, notification.expires, notification.priority);
NWLogWarn(@"Notification error: %@", error.localizedDescription);
if (error.code == kNWErrorAPNInvalidTokenContent) {
NWLogWarn(@"%@ error: Please set deviceToken properly in NWAppDelegate.", error.localizedDescription);
} else {
NWLogWarn(@"Notification error: %@", error.localizedDescription);
}
});
}

Expand Down