From dfc7d5e5fa1966ba3b08ec9eed70d940ab987e6b Mon Sep 17 00:00:00 2001 From: Chen Liang Date: Mon, 2 Apr 2018 16:34:54 -0700 Subject: improve logging when subscription failed (#1017) --- Firebase/Messaging/FIRMMessageCode.h | 1 + Firebase/Messaging/FIRMessagingTopicOperation.m | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'Firebase/Messaging') diff --git a/Firebase/Messaging/FIRMMessageCode.h b/Firebase/Messaging/FIRMMessageCode.h index 2b6ddad..1ec3a39 100644 --- a/Firebase/Messaging/FIRMMessageCode.h +++ b/Firebase/Messaging/FIRMMessageCode.h @@ -172,6 +172,7 @@ typedef NS_ENUM(NSInteger, FIRMessagingMessageCode) { kFIRMessagingMessageCodeTopicOption001 = 17001, // I-FCM017001 kFIRMessagingMessageCodeTopicOption002 = 17002, // I-FCM017002 kFIRMessagingMessageCodeTopicOptionTopicEncodingFailed = 17003, // I-FCM017003 + kFIRMessagingMessageCodeTopicOperationEmptyResponse = 17004, // I-FCM017004 // FIRMessagingUtilities.m kFIRMessagingMessageCodeUtilities000 = 18000, // I-FCM018000 kFIRMessagingMessageCodeUtilities001 = 18001, // I-FCM018001 diff --git a/Firebase/Messaging/FIRMessagingTopicOperation.m b/Firebase/Messaging/FIRMessagingTopicOperation.m index 1546d47..6703178 100644 --- a/Firebase/Messaging/FIRMessagingTopicOperation.m +++ b/Firebase/Messaging/FIRMessagingTopicOperation.m @@ -226,6 +226,8 @@ NSString *FIRMessagingSubscriptionsServer() { } NSString *response = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; if (response.length == 0) { + FIRMessagingLoggerDebug(kFIRMessagingMessageCodeTopicOperationEmptyResponse, + @"Invalid registration response - zero length."); [self finishWithError:[NSError errorWithFCMErrorCode:kFIRMessagingErrorCodeUnknown]]; return; } @@ -233,7 +235,7 @@ NSString *FIRMessagingSubscriptionsServer() { _FIRMessagingDevAssert(parts.count, @"Invalid registration response"); if (![parts[0] isEqualToString:@"token"] || parts.count <= 1) { FIRMessagingLoggerDebug(kFIRMessagingMessageCodeTopicOption002, - @"Invalid registration request, response"); + @"Invalid registration response %@", response); [self finishWithError:[NSError errorWithFCMErrorCode:kFIRMessagingErrorCodeUnknown]]; return; } -- cgit v1.2.3