我的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
答案 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]>