QuickBlox / quickblox-flutter-samples

quickblox-flutter-samples
3 stars 16 forks source link

"client_identification_sequence" is invalid ios #3

Closed nikunjrami151 closed 1 year ago

nikunjrami151 commented 3 years ago

I am trying to subscriptions for push notification. it's working in android but not working in ios. Try both .GCM and .APNS but both not working in ios.

Throw exception

flutter: enablePushNotification PlatformException message >>>> PlatformException(422 "client_identification_sequence" is invalid , null, Request failed: client error (422), null) flutter: enablePushNotification PlatformException code >>>> 422

String fcmToken =
        await sharedPrefsHelper.get(SharedPrefskey.fcmToken) as String;
    String channelName = QBPushChannelNames.GCM;
 if (Platform.isIOS) {
      // iOS-specific code
      channelName = QBPushChannelNames.APNS;
    }
    await QB.subscriptions.create(fcmToken, channelName);
kirillTolmachev commented 3 years ago

Please check your IOS certificates and please attach the logs.

nikunjrami151 commented 3 years ago

Please check your IOS certificates and please attach the logs.

ios Certificates is working fine.

=== Function =======

Future<void> enablePushNotification() async {
  try {
    String fcmToken =
        await sharedPrefsHelper.get(SharedPrefskey.fcmToken) as String;
    String channelName = QBPushChannelNames.GCM;

    if (Platform.isIOS) {
      // iOS-specific code
      channelName = QBPushChannelNames.APNS;
    }
    print('enablePushNotification deviceToken >>>> $fcmToken');
    print('enablePushNotification channelName  >>>> $channelName');
    await QB.subscriptions.create(
      fcmToken,
      channelName,
    );
  } on PlatformException catch (exception) {
    print(
        'enablePushNotification PlatformException message >>>> ${exception.toString()}');
    print(
        'enablePushNotification PlatformException code >>>> ${exception.code}');
  }
}

===== Log =============

flutter: enablePushNotification deviceToken >>>> fOiqGXJ2akyRqtSVZrJQkP:APA91bGG3r4qCi2FNrAv9YIHVOIDDbV-8CO1QnedjdCAIbLBBKxJLKdkPPLqGs-pexUGjxlid5arSQGEwqH2s64GIXN9lEhCKszXtDPn8YG-RQ05j4Tz1eBOwIhPSoRviZXwQJB1J1x3
flutter: enablePushNotification channelName  >>>> apns                  
[QBCore]: Request[4]:                                                   
GET URL:https://api.quickblox.com/account_settings.json                 
headers: {                                                              
    "Accept-Language" = "en-IN;q=1";                                    
    "QB-Account-Key" = yzj6LV6skqyHsCfjgQzj;                            
    "QB-OS" = "iOS 14.6";                                               
    "QB-SDK" = "iOS 2.17.10";                                           
    "QB-Token" = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NfdHlwZSI6ImFwcGxpY2F0aW9uIiwiYXBwbGljYXRpb25faWQiOjg2OTY5LCJpYXQiOjE2MjY0MDk3MDU2Nzg2Nzh9._Y4KAHsYoXS_a_KjFDXa2HedXs8ISvm4I8fqd2SCOkaKw-VGlaKBLffBG-xZkdixURooG65XE0Zn8nHAuiMRrA";
    "QuickBlox-REST-API-Version" = "0.1.1";                             
    "User-Agent" = "Runner/1.0 (iPhone; iOS 14.6; Scale/3.00)";         
}                                                                       
[QBCore]: Response[4]:                                                  
headers: {                                                              
    "Access-Control-Allow-Origin" = "*";                                
    "Cache-Control" = "max-age=0, private, must-revalidate";            
    "Content-Length" = 124;                                             
    "Content-Type" = "application/json; charset=utf-8";                 
    Date = "Fri, 16 Jul 2021 04:28:28 GMT";                             
    Duration = "0.290692";                                              
    Etag = "W/\"e545561202e48f08ebd0483cf29e48ff\"";                    
    Server = nginx;                                                     
    "Strict-Transport-Security" = "max-age=31536000; includeSubDomains, max-age=31536000;";
    "quickblox-rest-api-version" = "0.1.1";                             
    "referrer-policy" = "strict-origin-when-cross-origin";              
    "x-content-type-options" = nosniff;                                 
    "x-download-options" = noopen;                                      
    "x-frame-options" = SAMEORIGIN;                                     
    "x-permitted-cross-domain-policies" = none;                         
    "x-request-id" = "4024144f-e293-4343-9421-38361327cf1e";            
    "x-runtime" = "0.007352";                                           
    "x-xss-protection" = "1; mode=block";                               
}                                                                       
object: {                                                               
    "api_endpoint" = "https://api.quickblox.com";                       
    "chat_endpoint" = "chat.quickblox.com";                             
    "turnserver_endpoint" = "turn.quickblox.com";                       
}                                                                       
[Core]: Account Settings:                                               
 apiEndpoint: https://api.quickblox.com                                 
 chatEndpoint: chat.quickblox.com,                                      
 lastCheckDate: 2021-07-16 04:28:28 +0000                               
[QBCore]: Request[5]:                                                   
POST URL:https://api.quickblox.com/subscriptions.json                   
headers: {                                                              
    "Accept-Language" = "en-IN;q=1";                                    
    "Content-Type" = "application/x-www-form-urlencoded";               
    "QB-OS" = "iOS 14.6";                                               
    "QB-SDK" = "iOS 2.17.10";                                           
    "QB-Token" = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NfdHlwZSI6ImFwcGxpY2F0aW9uIiwiYXBwbGljYXRpb25faWQiOjg2OTY5LCJpYXQiOjE2MjY0MDk3MDU2Nzg2Nzh9._Y4KAHsYoXS_a_KjFDXa2HedXs8ISvm4I8fqd2SCOkaKw-VGlaKBLffBG-xZkdixURooG65XE0Zn8nHAuiMRrA";
    "QuickBlox-REST-API-Version" = "0.1.1";                             
    "User-Agent" = "Runner/1.0 (iPhone; iOS 14.6; Scale/3.00)";         
}                                                                       
parameters: {                                                           
    device =     {                                                      
        platform = ios;                                                 
        udid = "CD6A4C19-E181-4789-A197-F34C56DAA700";                  
    };                                                                  
    "notification_channels" = apns;                                     
    "push_token" =     {                                                
        "bundle_identifier" = "Com.traintalent";                        
        "client_identification_sequence" = 0f2a0aa91b03040c2f0a09dd0b8c01eddc0a0bbb0d0ed50a0e0264090e0c0d0805041e0bb101;
        environment = development;                                      
    };                                                                  
}                                                                       
[ChatService]: RCV: <iq xmlns="jabber:client" to="129238136-86969@chat.quickblox.com/CD6A4C19-E181-4789-A197-F34C56DAA700" type="result" id="FAF38BC2-A446-4326-9762-C80279283D9D"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>129238136-86969@chat.quickblox.com/CD6A4C19-E181-4789-A197-F34C56DAA700</jid></bind></iq>
[QBCore]: Response[5]                                                   
headers: {                                                              
    "Access-Control-Allow-Origin" = "*";                                
    "Cache-Control" = "no-cache";                                       
    "Content-Length" = 60;                                              
    "Content-Type" = "application/json; charset=utf-8";                 
    Date = "Fri, 16 Jul 2021 04:28:29 GMT";                             
    Duration = "0.307497";                                              
    Server = nginx;                                                     
    "Strict-Transport-Security" = "max-age=31536000; includeSubDomains";
    "quickblox-rest-api-version" = "0.1.1";                             
    "referrer-policy" = "strict-origin-when-cross-origin";              
    "x-content-type-options" = nosniff;                                 
    "x-download-options" = noopen;                                      
    "x-frame-options" = SAMEORIGIN;                                     
    "x-permitted-cross-domain-policies" = none;                         
    "x-request-id" = "f268f75f-8ca2-46b5-b45b-0c4b33237c07";            
    "x-runtime" = "0.026770";                                           
    "x-xss-protection" = "1; mode=block";                               
}                                                                       
error: Request failed: client error (422)                               
reasons: {                                                              
    errors =     {                                                      
        "client_identification_sequence" =         (                    
            "is invalid"                                                
        );                                                              
    };                                                                  
}                                                                       
flutter: enablePushNotification PlatformException message >>>> PlatformException(422
"client_identification_sequence" is invalid                             
, null, Request failed: client error (422), null)                       
flutter: enablePushNotification PlatformException code >>>> 422         
"client_identification_sequence" is invalid                             
[ChatService]: SMT: <enabled xmlns="urn:xmpp:sm:3"></enabled>           
[ChatService]: RCV: <iq xmlns="jabber:client" to="129238136-86969@chat.quickblox.com/CD6A4C19-E181-4789-A197-F34C56DAA700" type="result" id="245952A6-CCB1-46AA-A49D-168CF9C59350"><query xmlns="jabber:iq:roster"/></iq>
[ChatService]: RCV: <presence xmlns="jabber:client" to="129238136-86969@chat.quickblox.com" from="129238136-86969@chat.quickblox.com/CD6A4C19-E181-4789-A197-F34C56DAA700"/>
Activating Dart DevTools... 
ghost commented 3 years ago

Hello,

This is Nikolay from QuickBlox support.

If the issue is still relevant, please let us know.

You may try updating the QuickBlox Flutter SDK to the latest version: https://pub.dev/packages/quickblox_sdk/versions/0.6.0-beta