如何在目标c中解决此“警告永远不会被执行”的警告?

时间:2017-10-10 05:52:37

标签: objective-c firebase

它显示警告代码永远不会被执行。我检查了3次我的代码,但不知道如何解决此警告?

var myConfig = new AWS.Config({
    credentials: myCredentials, region: 'eu-west-1',
  });

1 个答案:

答案 0 :(得分:-1)

你错过了前面的支架,这就是为什么它会发出警告。请尝试以下代码。

[[[[self.dbRef child:@"Status"] child:user.uid] child:@"Details"] observeSingleEventOfType:FIRDataEventTypeValue withBlock:^(FIRDataSnapshot * _Nonnull snapshot) {

    //Add Current User Image.....
    [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me?fields=name,picture.height(100).width(100)" parameters:nil]startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
        //NSLog(@"Result is : %@",result);
        NSDictionary *dictionary = (NSDictionary *) result;
        NSDictionary *data3 = [dictionary objectForKey: @"picture"];
        NSDictionary *data2 = [data3 objectForKey: @"data"];
        NSString *photoURL = (NSString *)[data2 objectForKey:@"url"];
        NSData *imgData = [NSData dataWithContentsOfURL: [NSURL URLWithString: photoURL]];
        cell.imgUser.image = [UIImage imageWithData: imgData];
        [tableView reloadData];
    }];


    //Show current user name....
    [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me?fields=name,picture.height(100).width(100),name" parameters:nil]startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {

        NSString *currentUName = snapshot.value[@"name"];
        NSArray *currentUNameArr = [NSArray arrayWithObject:currentUName];
        cell.lblUName.text = currentUNameArr[indexPath.row];
        [tableView reloadData];
    }];

} withCancelBlock:^(NSError * _Nonnull error) {
    NSLog(@"%@",error.localizedDescription);
}];