Timer对象值未通过实例

时间:2018-02-20 06:34:51

标签: ios objective-c segue nsdictionary sender

此应用程序(通过字典)将以下两个实例的数据发送给发件人的其他视图。

  1. 主页Tableview根据每个状态细化到每个特定视图 Ex-IF状态1 - AppointmentView 2 - OnthewayView 3 - TimerView 4 - 发票视图。

    • 主页--->预约
    • 主页---> ontheWay
    • 主页---> TimerView
    • 主页--->发票
  2. 首页---> AppointmentView ---> ontheway - > 计时器--->发票

  3. 导航计时器时出现问题 - >将计时器作为空计时器=“”发票,因此我的某些功能(时间费用计算)仅在此实例上不起作用。

    但与我回到家和家的第一个例子相同 - > invoice timer = 10,其余功能正常工作。

    第一个实例的代码段(工作代码)(homeviewcontroller)

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
        if (indexPath.section==0) {
            if (bookingArray.count) {
                NSInteger keyStatus =[bookingArray[indexPath.row][@"status"] integerValue] ;
                switch (keyStatus) {
                    case 2:
                        [self performSegueWithIdentifier:@"appointmentDetail" sender:bookingArray[indexPath.row]];
                        break;
                    case 5:
                        [self performSegueWithIdentifier:@"ToMapController" sender:bookingArray[indexPath.row]];
                        break;
                    case 6:
                        [self performSegueWithIdentifier:@"ToTimerVC" sender:bookingArray[indexPath.row]];
                        break;
                    case 21:
                        [self performSegueWithIdentifier:@"ToTimerVC" sender:bookingArray[indexPath.row]];
                        break;
                    case 22:
                        [self performSegueWithIdentifier:@"ToInvoice" sender:bookingArray[indexPath.row]];
                        break;
                }
    

    第二个实例(不工作)(timerViewController)

    -(void)onTHEWAYButtonTapped
    {
    
        self.navigationItem.leftBarButtonItem.enabled = NO;
    
        [[ProgressIndicator sharedInstance]showPIOnView:self.view withMessage:NSLocalizedString(@"Loading..",@"Loading..")];
    
        switch (_bookingStatu) {
            case 2:
            case 5:
            case 21:{
                _bookingStatu = 6;
    
                break;
            }
            case 6:{
                _bookingStatu = 22;
                break;
            }
            default:
                break;
        }
        NSDictionary *parameters;
        if (_bookingStatu==6) {
            parameters = @{
                           kSMPcheckUserSessionToken: [[NSUserDefaults standardUserDefaults] objectForKey:KDAcheckUserSessionToken],
                           kSMPCommonDevideId       :[[NSUserDefaults standardUserDefaults] objectForKey:kPMDDeviceIdKey],
                           @"ent_appnt_dt"          :self.dictBookingDetails[@"apntDt"],
                           KSMPPatientEmail         :self.dictBookingDetails[@"email"],
                           kSMPRespondResponse      :[NSString stringWithFormat:@"%ld",(long)_bookingStatu],
                           @"ent_date_time"         :[Helper getCurrentDateTime],
                           @"ent_bid"                :self.dictBookingDetails[@"bid"],
                           @"bookingId"              :_dictBookingDetails[@"bid"],
                           @"technicianId"           :[[NSUserDefaults standardUserDefaults] objectForKey:@"ProviderId"],
                           @"latitude"                :_dictBookingDetails[@"apptLat"],
                           @"longitude"               :_dictBookingDetails[@"apptLong"]
                           //temp test
    
    
    
                           };
            NSLog(@"Check the sent param-1%@",parameters);
        }else if (_bookingStatu==22)  {
            parameters = @{
                           kSMPcheckUserSessionToken: [[NSUserDefaults standardUserDefaults] objectForKey:KDAcheckUserSessionToken],
                           kSMPCommonDevideId       :[[NSUserDefaults standardUserDefaults] objectForKey:kPMDDeviceIdKey],
                           @"ent_appnt_dt"          :self.dictBookingDetails[@"apntDt"],
                           KSMPPatientEmail         :self.dictBookingDetails[@"email"],
                           kSMPRespondResponse      :[NSString stringWithFormat:@"%ld",(long)_bookingStatu],
                           @"ent_date_time"         :[Helper getCurrentDateTime],
                           @"ent_bid"                :self.dictBookingDetails[@"bid"],
                           @"ent_timer":[NSString stringWithFormat:@"%d",(timeHr*3600)+(timeMin*60)+timeSec],
                           @"bookingId"              :_dictBookingDetails[@"bid"],
                           @"technicianId"           :[[NSUserDefaults standardUserDefaults] objectForKey:@"ProviderId"],
                           @"latitude"                :_dictBookingDetails[@"apptLat"],
                           @"longitude"               :_dictBookingDetails[@"apptLong"],
    
                           };
    
            NSLog(@"Check the sent param-2%@",parameters);
        }
    
        NetworkHandler *handler = [NetworkHandler sharedInstance];
    
        [handler composeRequestWithMethod:MethodupdateApptStatus
                                  paramas:parameters
                             onComplition:^(BOOL succeeded, NSDictionary *response) {
                                 [[ProgressIndicator sharedInstance]hideProgressIndicator];
                                 [_customSliderView sliderImageOrigin];
                                 if (succeeded) {
                                     if ([response[@"errFlag"] isEqualToString:@"1"]) {
                                         [Helper showAlertWithTitle:NSLocalizedString(@"Message", @"Message") Message:response[@"errMsg"]];
                                         if([[response objectForKey:@"errNum"] intValue] == 41){
                                             [Helper showAlertWithTitle:NSLocalizedString(@"Error",@"Error") Message:[response objectForKey:@"errMsg"]];
                                             [self backButtonPressed];
                                         }else if ([[response objectForKey:@"errNum"] intValue] == 83){
                                             [self userSessionTokenExpire];
                                         }
                                     }else{
    
                                         [self emitTheBookingACk:_bookingStatu];
                                         [self updateCustomerinfo];
                                         if (_bookingStatu==22) {
                                             [self getTimerAPI];
    
                                             [self performSegueWithIdentifier:@"toInvoiceSegue" sender:_dictBookingDetails];
                                         }else if (_bookingStatu==6){
                                             [self pauseTimer:nil];
                                         }
                                     }
                                 }
                                 else
                                 {
                                     NSLog(@"Error");
                                     [[ProgressIndicator sharedInstance] hideProgressIndicator];
                                 }
                             }];
    
    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    
         if([segue.identifier isEqualToString:@"toReportView"])
        {
            RecomReportViewController *reportView = (RecomReportViewController *)segue.destinationViewController;
            reportView.bookingId = bookingID;
            reportView.taskLocation = taskLocation;
    
        }
       else if([[segue identifier] isEqualToString:@"toInvoiceSegue"])
        {
            InvoiceViewController *details =[segue destinationViewController];
    
            details.minutesCount=[NSString stringWithFormat:@"%d",(timeHr*3600)+(timeMin*60)+timeSec];
            details.currentTimer = timerfinished;
            [self getTimerAPI];
            details.dictBookingDetails = sender;
    
        }
    
        return;
    

    InvoiceViewController.m -

    - (void)viewDidLoad {
        [super viewDidLoad];
        //sending request to get materialfee
        NSString *testTimer = _dictBookingDetails[@"timer"];
    }
    

    请帮我找出错误并解决问题......

0 个答案:

没有答案