0
我調用let push = IMFPushClient.sharedInstance() logger?.logInfoWithMessages("subscribe to tags: \(tagsArray)") push.subscribeToTags([tagsArray]) { (response: IMFResponse!, error: NSError!) -> Void in
訂閱標籤,但從堆棧跟蹤獲得400。Bluemix推送通知,當訂閱標籤達到400時
2016-01-22 16:48:10.648 gschat-swift[44084:5194666] [INFO] [BlueList] subscribe to tags: ["Test"]
2016-01-22 16:48:10.648 gschat-swift[44084:5194666] [INFO] [IMFPushClient] -[IMFPushClient subscribeToTags:completionHandler:] in IMFPushClient.m:314 :: Entering: subscribeToTags.
2016-01-22 16:48:10.650 gschat-swift[44084:5194666] [DEBUG] [IMF] +[WLAFHTTPClientWrapper requestWithURL:] in WLAFHTTPClientWrapper.m:44 :: Request url is https://ChatBMS.mybluemix.net/imfpush/v1/apps/2b7d11a9-57bf-47e6-8a4c-8aabf044ac8a/subscriptions
2016-01-22 16:48:10.653 gschat-swift[44084:5194666] [DEBUG] [IMF] -[WLAFHTTPClientWrapper start] in WLAFHTTPClientWrapper.m:194 :: Starting the request with URL https://ChatBMS.mybluemix.net/imfpush/v1/apps/2b7d11a9-57bf-47e6-8a4c-8aabf044ac8a/subscriptions
2016-01-22 16:48:11.255 gschat-swift[44084:5194362] [DEBUG] [IMF] -[WLAFHTTPClientWrapper requestFailed:error:] in WLAFHTTPClientWrapper.m:215 :: Request Failed
2016-01-22 16:48:11.256 gschat-swift[44084:5194362] [DEBUG] [IMF] -[WLAFHTTPClientWrapper requestFailed:error:] in WLAFHTTPClientWrapper.m:216 :: Response Status Code : 400
2016-01-22 16:48:11.257 gschat-swift[44084:5194362] [DEBUG] [IMF] -[WLAFHTTPClientWrapper requestFailed:error:] in WLAFHTTPClientWrapper.m:217 :: Response Error : Expected status code in (200-299), got 400
2016-01-22 16:48:11.259 gschat-swift[44084:5194362] [ERROR] [IMFPushClient] __51-[IMFPushClient subscribeToTags:completionHandler:]_block_invoke in IMFPushClient.m:350 :: Error while subscribing to tags - Error is: Error Domain=WLAFNetworkingErrorDomain Code=-1011 "Expected status code in (200-299), got 400" UserInfo={WLAFNetworkingOperationFailingURLRequestErrorKey=<NSMutableURLRequest: 0x7f89b8d8dd10> { URL: https://ChatBMS.mybluemix.net/imfpush/v1/apps/2b7d11a9-57bf-47e6-8a4c-8aabf044ac8a/subscriptions }, NSLocalizedRecoverySuggestion={"message":"Bad Request - Invalid JSON","code":"FPWSE0004E"}, NSErrorFailingURLKey=https://ChatBMS.mybluemix.net/imfpush/v1/apps/2b7d11a9-57bf-47e6-8a4c-8aabf044ac8a/subscriptions, WLAFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x7f89b8eb7f00> { URL: https://chatbms.mybluemix.net/imfpush/v1/apps/2b7d11a9-57bf-47e6-8a4c-8aabf044ac8a/subscriptions } { status code: 400, headers {
Connection = "Keep-Alive";
"Content-Type" = "application/json";
Date = "Fri, 22 Jan 2016 16:48:09 GMT";
"Transfer-Encoding" = Identity;
"X-Backside-Transport" = "FAIL FAIL";
"X-Cf-Requestid" = "cf162009-bd95-46d2-46ca-3cad50a70153";
"X-Client-IP" = "80.111.218.187";
"X-Global-Transaction-ID" = 2240839783;
"X-Powered-By" = "Servlet/3.0";
} }, NSLocalizedDescription=Expected status code in (200-299), got 400}
2016-01-22 16:48:11.260 **gschat-swift[44084:5194362] [FATAL] [BlueList] error Error Domain=com.ibm.mobilefoundation.push Code=10 "Expected status code in (200-299), got 400" UserInfo={WLAFNetworkingOperationFailingURLRequestErrorKey=<NSMutableURLRequest: 0x7f89b8d8dd10> { URL: https://ChatBMS.mybluemix.net/imfpush/v1/apps/2b7d11a9-57bf-47e6-8a4c-8aabf044ac8a/subscriptions }, NSLocalizedRecoverySuggestion={"message":"Bad Request - Invalid JSON","code":"FPWSE0004E"}, NSErrorFailingURLKey=https://ChatBMS.mybluemix.net/imfpush/v1/apps/2b7d11a9-57bf-47e6-8a4c-8aabf044ac8a/subscriptions, WLAFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x7f89b8eb7f00> { URL: https://chatbms.mybluemix.net/imfpush/v1/apps/2b7d11a9-57bf-47e6-8a4c-8aabf044ac8a/subscriptions } { status code: 400, headers {
Connection = "Keep-Alive";
"Content-Type" = "application/json";
Date = "Fri, 22 Jan 2016 16:48:09 GMT";
"Transfer-Encoding" = Identity;
"X-Backside-Transport" = "FAIL FAIL";
"X-Cf-Requestid" = "cf162009-bd95-46d2-46ca-3cad50a70153";
"X-Client-IP" = "80.111.218.187";
"X-Global-Transaction-ID" = 2240839783;
"X-Powered-By" = "Servlet/3.0";
} }, NSLocalizedDescription=Expected status code in (200-299), got 400} in subscribe to tags:["Test"]**
謝謝,約什。我在服務器上有「測試」標籤,我可以通過儀表板看到它。那麼我做push.subscribeToTags([「測試]),標籤是唯一需要的參數。json中的哪個參數是無效的?它是否需要設備ID?我訂閱標籤前註冊了設備。訂閱所有可用的標籤手機只訂閱標籤的一個子集 –
嗨喬希,經過一些測試後,我發現如果設備訂閱了它已經提交的標籤,它將會失敗,例如,如果它有訂閱「tag1」時,subscribeToTags([「tag1」,「tag2」])將失敗,代碼爲400.此時,它仍然訂閱了「tag1」,但沒有訂閱「tag2」。標籤,並只訂閱可用的內容。 –