我从头开始重建了聊天应用示例,一切正常,直到我尝试加载用户列表。当我尝试加载时,没有显示任何名称,只显示“错误”弹出警报视图。有关如何解决这个问题的任何问题?我几乎使用了聊天示例中的确切代码。这是我做的:
@implementation UsersViewController
- (void)viewDidLoad
{
[super viewDidLoad];
QBUUser *user = [QBUUser user];
[QBUsers signUp:user delegate:self];
[QBAuth createSessionWithDelegate:self];
[QBUsers logInWithUserLogin:@"%@" password:@"%@" delegate:self];
[QBUsers userWithExternalID:46732 delegate:self];
self.users = [NSMutableArray array];
self.selectedUsers = [NSMutableArray array];
self.paginator = [[UsersPaginator alloc] initWithPageSize:10 delegate:self];
}
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
// Fetch 10 users
[self.paginator fetchFirstPage];
答案 0 :(得分:1)
你不能这样做:
[QBUsers signUp:user delegate:self];
[QBAuth createSessionWithDelegate:self];
[QBUsers logInWithUserLogin:@"%@" password:@"%@" delegate:self];
[QBUsers userWithExternalID:46732 delegate:self];
所有这些请求都是异步的,而不是同步的
你必须等到每个请求完成才能执行下一个请求