名为' objectAtIndex的多种方法:'发现结果不匹配,参数类型或属性

时间:2015-11-18 23:17:55

标签: ios objective-c

我的ios应用上有一个表格显示最后的推文,但是在将我的应用更新为64位架构之后,我得到了以下错误的四倍:multiple methods named 'objectAtIndex:' found with mismatched result, parameter type or attributes error.

这是代码的相关部分:

-(void)tableView:(UITableView*)tableView didHoldRowAtIndexPath:(NSIndexPath*)indexPath {    

if ([NXCatchall isiPad]) {

    NSDictionary *tweet = [twitterHandler getTweetForArrayIndex:indexPath.row];

    NSDictionary *urls = [[tweet objectForKey:@"entities"] objectForKey:@"urls"];

    urlDict = [NSMutableDictionary dictionary];

    for (int i=0; i<urls.count; i++) {
        NSString *displayName = [[urls valueForKey:@"display_url"] objectAtIndex:i];
        NSURL    *url         = [NSURL URLWithString:[[urls valueForKey:@"expanded_url"]objectAtIndex:i]];
        [urlDict setValue:url forKey:displayName];

    }

    if (urlDict.count != 0) {


    UIActionSheet *actionSheet = [[UIActionSheet alloc] init];
    [actionSheet setTitle:@"Open in Safari"];
    [actionSheet setDelegate:self];

for (int i=0; i<urlDict.count; i++) {
    // NSString *key = [[dict allKeys] objectAtIndex:i];
    //Yes it's ugly, it works at runtime. Deal with it.
    [actionSheet addButtonWithTitle:[[urlDict valueForKey:(NSString*)
                                      [[urlDict allKeys]objectAtIndex:i]]absoluteString]];
}
    [[NSNotificationCenter defaultCenter] postNotificationName:@"heldTweetWithInfo" object:self userInfo:[NSDictionary dictionaryWithObject:actionSheet forKey:@"actionSheet"]];


    }
}
}

#pragma mark - Table view delegate

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary *tweet = [twitterHandler getTweetForArrayIndex:indexPath.row];

if ([NXCatchall isiPad]) {

    [[NSNotificationCenter defaultCenter] postNotificationName:@"selectedTweetNotification" object:self userInfo:tweet];

}

NSDictionary *urls = [[tweet objectForKey:@"entities"] objectForKey:@"urls"];

urlDict = [NSMutableDictionary dictionary];

for (int i=0; i<urls.count; i++) {
        NSString *displayName = [[urls valueForKey:@"display_url"] objectAtIndex:i];
        NSURL    *url         = [NSURL URLWithString:[[urls valueForKey:@"expanded_url"]objectAtIndex:i]];
        [urlDict setValue:url forKey:displayName];

    }

受影响的行以 NSString &amp;的 NSURL

1 个答案:

答案 0 :(得分:0)

尝试将其投射到NSArray中。我的猜测是其他一些类声明了objectAtIndex。

    (byebug) @event_booking.package_bookings.first.id
  PackageBooking Load (0.3ms)  SELECT  "package_bookings".* FROM "package_bookings" WHERE "package_bookings"."event_booking_id" = $1  ORDER BY "package_bookings"."id" ASC LIMIT 1  [["event_booking_id", 6]]
23
(byebug) @event_booking.package_bookings.first
  CACHE (0.0ms)  SELECT  "package_bookings".* FROM "package_bookings" WHERE "package_bookings"."event_booking_id" = $1  ORDER BY "package_bookings"."id" ASC LIMIT 1  [["event_booking_id", 6]]
#<PackageBooking id: 23, package_id: 23, event_booking_id: 6, quantity_tickets: 1, created_at: "2015-11-19 08:55:06", updated_at: "2015-11-19 08:55:06", sub_options_selected: [27]>