iOS - 将字典作为参数从 AFNetworking GET 传递的问题

标签 ios objective-c afnetworking

我正在尝试将从使用AFNetworkingGET 请求接收到的字典传递给类方法参数。但是我收到了这个错误。

+[SASwipeButtonSettings performActionForLeftSwipeWithVideo:]: unrecognized selector sent to class 0x3a42a8
2015-06-29 15:03:38.526 StreamacyBeta[3712:1057453] *** Terminating app due to uncaught exception 'NSInvalidArgumentException'

这就是我检索和传递数据的方式。

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    [manager GET:youtubeApi parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        self.videos = responseObject[@"items"];
        [self.tableView reloadData];
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"Error: %@", error);
    }];



-(BOOL)swipeTableCell:(MGSwipeTableCell *)cell tappedButtonAtIndex:(NSInteger)index direction:(MGSwipeDirection)direction fromExpansion:(BOOL)fromExpansion
{
    NSIndexPath *indexPath = [self.tableView indexPathForCell:(UITableViewCell *)cell];
    NSDictionary *selectedVideo = self.videos[indexPath.row];

    if (direction == MGSwipeDirectionLeftToRight) {
        [SASwipeButtonSettings performActionForLeftSwipeWithVideo:selectedVideo];
    }  
    return YES;
}

知道我为什么会遇到这个问题吗?我的方法中的参数只接受一个 NSDictionary

最佳答案

您的类 SASwipeButtonSettings 似乎没有实现采用 NSDictionary* 的静态方法 performActionForLeftSwipeWithVideo。这似乎不是 AFNetworking 问题。

关于iOS - 将字典作为参数从 AFNetworking GET 传递的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31123617/

相关文章:

ios - 将 HTTP Body 设置为 AFNetworking 而不是使用 native 请求

ios - AF网络应用程序/json

iphone - 混合模式,可自由绘制重叠的UIColor

ios - 是通过编程方式将设备iPhone或iPad

iphone - NSManagedObjectContext,传递它的最佳方式?访问它?

iphone - 确定日期是否发生变化

ios - iOS 8 扩展的 AFNetworking 后台 session 配置

iphone - iOS 中每个 View Controller 的静态 View

iOS 默认项目语言

ios - 无法访问 Realm 获取的数据