错误:_block_literal_generic或_block_invoke

时间:2015-04-30 03:43:52

标签: ios objective-c

我在iOS应用程序中发现此崩溃的来源时遇到问题,该应用程序具有使用iPhone应用程序的核心数据模型,我无法登录URl。我在iOS 7上使用相同的代码,但是现在我正在尝试在iOS 8.2上工作。问题是_block_literal_generic

enter image description here

阻止点在下面同时检查屏幕截图错误:---

[[NetwokManager sharedInstance] loginRequestEmail:userEmail andPassword:userPassword WithResponse:^(id responseObject,NSError * error){if(!error){ }

使用代码如下:

-(void)sendLoginRequest
{
    NSString *userEmail = [[NSUserDefaults standardUserDefaults] objectForKey:@"emailKey"];
    NSString *userPassword = [[NSUserDefaults standardUserDefaults] objectForKey:@"passwordKey"];
    NSLog(@"Email %@", userEmail);
    NSLog(@"Password %@", userPassword);
    NSString *mobileNo = [SCUserProfile currentUser].callerid;
    NSLog(@"CallerID %@", mobileNo);
    [[NetwokManager sharedInstance] loginRequestEmail:userEmail andPassword:userPassword WithResponse:^(id responseObject, NSError *error) {
        if (!error) {

            NSLog(@"responseString = %@", responseObject);

            if (responseObject == nil)
            {
                NSLog(@"No data from server");

                UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error"
                                                                    message:@"No data downloaded from server!"
                                                                   delegate:nil
                                                          cancelButtonTitle:@"OK"
                                                          otherButtonTitles: nil];
                [alertView show];

            }

            NSDictionary *resposneDict = (NSDictionary*)responseObject;
            NSString *success = [resposneDict valueForKey:@"success"];
            if ([success isEqual:@"Authentication Failed"])
            {
                [self showAlertViewWithMessage:@"Authentication Failed"];
                // [self sendLogoutRequest];
                [[C2CallAppDelegate appDelegate] logoutUser];

            }
            else if ([success intValue] == 1)
            {
                amobilePayUserID = [resposneDict valueForKey:@"user_id"];
                [[NSUserDefaults standardUserDefaults] setValue:amobilePayUserID forKey:@"AMobilePay_User_ID"];
                NSLog(@"User Id is:= %@",amobilePayUserID);
            }
            else if ([success intValue] == 0)
            {
                //[self sendRegistrationRequest];
                // [self sendLogoutRequest];
                // [[C2CallAppDelegate appDelegate] logoutUser];
            }
            else
            {
                [self showAlertViewWithMessage:@"Unable to login AmobilePay"];
            }
        } else {
            [self showAlertViewWithMessage:[error localizedDescription]];
        }
    }];
}

1 个答案:

答案 0 :(得分:0)

  

未知地区崩溃2015-04-30 09:56:18.390 AmobipayMerchant [337:60b] ***由于未捕获的异常终止应用程序' NSInvalidArgumentException',原因:' - [MOC2CallEvent cost]:无法识别的选择器发送到实例0x16ef2dd0'

在代码的某处,您将costs调用为MOC2CallEvent的实例。 MOC2CallEvent没有方法或属性costs,所以它当然会崩溃。