获取AlertView的变量信息

时间:2014-04-07 23:57:54

标签: ios parse-platform uialertview

我现在正在使用Qualcomm信标并使用visit.transmitter.name来识别我在Parse DB中想要的对象。它似乎正在工作,因为日志显示数据但不确定如何在警报视图中使用@"address: %@", [object objectForKey:@"address"]以便标题。我的equalTo:(@"%@",visit.transmitter.name)];也收到Expression Result Unused

错误
PFQuery *query = [PFQuery queryWithClassName:@"houses"];
    [query whereKey:@"name" equalTo:(@"%@",visit.transmitter.name)];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (!error) {
            for (PFObject *object in objects) {
                NSLog(@"address: %@", [object objectForKey:@"address"]);
                NSLog(@"url:: %@", [object objectForKey:@"url"]);

                NSString *displayAddress = [object objectForKey:@"address"];

                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:displayAddress
                                                                message:@"THIS WOULD BE THE TITLE, DESCRIPTION"
                                                               delegate:nil
                                                      cancelButtonTitle:@"OK" 
                                                      otherButtonTitles:@"THIS WOULD BE THE URL"]; 
                [alert show];

            }
        } else {
            // Log details of the failure
            NSLog(@"Error: %@ %@", error, [error userInfo]);
        }

1 个答案:

答案 0 :(得分:0)

使用stringWithFormat:

NSString *displayAddress = [NSString stringWithFormat:@"address: %@", [object objectForKey:@"address"]];