Search code examples
iosibm-cloudibm-mobilefirstibm-mobile-services

Error Registering Client IBM Mobile First


I'm using IBM Mobile First Starter pack and am unable to find out how to resolve the error "Error Registering Client". Is there a way to debug this? This started appearing as of yesterday on my mobile application, and since this morning on my simulator as well. I suspect my simulator worked because it was caching credentials.

2015-11-26 18:44:54.835 bluelist-objective-c[32334:2189606] Intializing IMFCLient
2015-11-26 18:44:54.836 bluelist-objective-c[32334:2189606] IapplicationRoute [appurl]
2015-11-26 18:44:54.836 bluelist-objective-c[32334:2189606] IapplicationId [app id]
2015-11-26 18:44:55.286 bluelist-objective-c[32334:2189606] [ERROR] [IMF_REQUEST] -
[IMFAuthorizationRequest requestFailed:error:] in IMFAuthorizationRequest.m:368 :: 
Status code='400' error='Expected status code in (200-299), got 400' response='Error 
registering client'
2015-11-26 18:44:55.289 bluelist-objective-c[32334:2189606] [ERROR] [IMF] -
[IMFAuthorizationRequest requestFailed:error:] in IMFAuthorizationRequest.m:372 :: 
Error=Error Domain=WLAFNetworkingErrorDomain Code=-1011 "Expected status code in (200-299), 
got 400" UserInfo={WLAFNetworkingOperationFailingURLRequestErrorKey=<NSMutableURLRequest: 
0x7ff9714135b0> { URL: [appurl]/imf-authserver/authorization/v1/apps/
6e88ec09-fa48-4848-aeef-8fe59c3226e9/clients/instance }, NSLocalizedRecoverySuggestion=
Error registering client, NSErrorFailingURLKey=[appurl]/imf-authserver/authorization/v1/
apps/6e88ec09-fa48-4848-aeef-8fe59c3226e9/clients/instance, 
WLAFNetworkingOperationFailingURLResponseErrorKey
=<NSHTTPURLResponse: 0x7ff971536660> { URL: [appurl]/imf-authserver/authorization/v1/apps/
6e88ec09-fa48-4848-aeef-8fe59c3226e9/clients/instance } { status code: 400, headers {
    Connection = "Keep-Alive";
    "Content-Type" = "text/plain";
    Date = "Fri, 27 Nov 2015 02:44:55 GMT";
    "Transfer-Encoding" = Identity;
    "X-Backside-Transport" = "FAIL FAIL";
    "X-Cf-Requestid" = "aad33684-69d5-4535-433a-216e141a3d2d";
    "X-Client-IP" = "50.174.210.191";
    "X-Global-Transaction-ID" = 1566005617;
    "X-Powered-By" = "Servlet/3.0";
} }, NSLocalizedDescription=Expected status code in (200-299), got 400}

Solution

  • That canOpenURL: failed for URL:"fbauth2://" error is indicative of an issue with your Info.plist security settings. First I'd confirm or add the following LSApplicationQueriesSchemes values to your Info.plist.

    As per Facebook's recommendations outlined here

    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbapi</string>
        <string>fbapi20130214</string>
        <string>fbapi20130410</string>
        <string>fbapi20130702</string>
        <string>fbapi20131010</string>
        <string>fbapi20131219</string>    
        <string>fbapi20140410</string>
        <string>fbapi20140116</string>
        <string>fbapi20150313</string>
        <string>fbapi20150629</string>
        <string>fbauth</string>
        <string>fbauth2</string>
        <string>fb-messenger-api20140430</string>
    </array>
    

    If that does not resolve the issue on its own I would also look at replacing your Application Transport Security definitions in your Info.plist as well. For the sake of testing you may want to replace your full ATS with

    <key>NSAppTransportSecurity</key>
    <dict>
      <key>NSAllowsArbitraryLoads</key>
          <true/>
    </dict>
    

    There's some more information on IBM blog posts about ATS and iOS9 in general working with Bluemix that can be found here and here