2014-07-24 69 views
1

我這樣做,因爲這功能對每一個應用程序啓動執行在「didRegisterForRemoteNotification」API請求/秒 - 推送通知

PFInstallation *currentInstallation = [PFInstallation currentInstallation]; 
[currentInstallation setDeviceTokenFromData:deviceToken]; 
[currentInstallation saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { 
       NSLog(@"Device token updated! %d", succeeded); 
}]; 

以下 - 我的問題是這是否計入到REQ/s的算嗎?

如果這樣能夠節省我的REQ/s的數 - 而且這還是可靠:

PFInstallation *currentInstallation = [PFInstallation currentInstallation]; 
if (![[currentInstallation valueForKey:@"deviceToken"] isEqualToString: 
     [[[[NSString stringWithFormat:@"%@", deviceToken] 
     stringByReplacingOccurrencesOfString:@" " withString:@""] 
     stringByReplacingOccurrencesOfString:@"<" withString:@""] 
     stringByReplacingOccurrencesOfString:@">" withString:@""]]) { 

      [currentInstallation setDeviceTokenFromData:deviceToken]; 
      [currentInstallation saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { 
       NSLog(@"Device token updated! %d", succeeded); 
      }]; 
     } else { 
      NSLog(@"DEVICE TOKEN UNCHANGED"); 
     } 

我想使用parse.com爲大規模應用的推送服務(300-700k活躍uniq設備) - 我沒有使用parse-core部分 - 所以我試圖評估30/s自由模型是否符合我的要求。

會發生什麼 - 如果達到REQ限制 - 在didRegisterForRemoteNotificationsWithDeviceToken

問候內

回答

2

一般[currentInstallation saveInBackground]將朝着網絡API計數器計數 - 它是一樣保存任何其他對象數據庫,您可以通過檢查令牌是否已更改並僅發送更新來進行優化(我不知道解析SDK是否爲您執行此操作)

但請記住,該請求是由分鐘執行的,而不是每個第二,所以它不是30reqs /秒,而是1800reqs/minut e爲用戶數量提供了更大的保證金:-) 達到限制時,溢出的請求將被丟棄。你可以重試請求,例如...我認爲saveInBackground或saveEventually做重試。