2017-01-12 4 views
0

私はNSDateパラメータをtime.Iに取得しているサーバから応答を得ています。ナビゲーションバーに通知ボタンがあります。 45分、通知ボタンに調査の数を表示する必要があります。ボタンを押した後、調査の質問が含まれている調査が記入されます.45分前に通知が表示されます。ページがロードされてから45分後にボタンに通知を表示

今、私のコードは、この

-(void)checkForResponse:(HRNetworkDataModel *)dataModel 
{ 
    [HRUtility stopActivityIndicatorFromView:self.navigationController.view]; 
    if ([dataModel.responseData[@"community_details"][@"status"][@"message"]isEqualToString:@"successful"]) 
    { 
     self.pendingSurveyArray = dataModel.responseData[@"community_details"][@"data"][@"community_details"]; 
     NSMutableArray *finalSurveyArray = [[NSMutableArray alloc] init]; 
     for (NSInteger i=0; i<self.pendingSurveyArray.count;i++) 
     {   NSDictionary *tDict = self.pendingSurveyArray[i]; 
      if((([tDict[@"survey_flag"] isEqualToNumber:[NSNumber numberWithBool:0]]) || [tDict[@"survey_flag"] isEqualToNumber:[NSNumber numberWithBool:0]]) ||[tDict[@"survey_flag"] isEqualToNumber:[NSNumber numberWithBool:0]]) 
{ 
       [finalSurveyArray addObject:tDict]; 
       self.communityVisitedDate = tDict[@"visited_time"]; 
    } 

     } 

     if (finalSurveyArray.count == 0) 
     { 
      return; 
     } 
     else 
     { 
      dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 45 *60 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ 
        [self.navigationItem.rightBarButtonItems[0] setBadgeValue:[NSString stringWithFormat:@"%lu",(unsigned long)finalSurveyArray.count]]; 

      }); 

     } 

    } 
} 

のように見えるすべてのヘルプは理解されるであろう。

答えて

0

ストアNSUserDefaultsにおける応答時間と保存時刻と現在時刻の差が同じであるか、または表示通知

以上より45分場合viewWillAppear法に現在時刻とその時刻とを比較
関連する問題