2014-10-20 45 views
0

您好我能夠以用戶身份進行身份驗證,並且想要與Quick Blox所有者聊天,因此請使用所有者ID與當前經過身份驗證的用戶聊天。QuickBlox-在一對一聊天中獲取線程錯誤

我的代碼---

- (void)chatLogin 
{ 
QBChatDialog *chatDialog = [QBChatDialog new];  
chatDialog.name [email protected]"Chat With Me";  
chatDialog.occupantIDs = @[@(1111)]; 
chatDialog.type = QBChatDialogTypePrivate; 
[QBChat createDialog:chatDialog delegate:self]; 
} 

- (void)viewDidLoad 
{ 
[super viewDidLoad]; 
[self chatLogin]; 
// Do any additional setup after loading the view. 
self.messages = [NSMutableArray array]; 
self.messagesTableView.separatorStyle = UITableViewCellSeparatorStyleNone; 

} 

代碼響應結果---

- (void)completedWithResult:(Result *)result 
{ 
if (result.success || [result isKindOfClass:QBChatHistoryMessageResult.class] || [result isKindOfClass:[QBChatDialogResult class]]) 
{ 
    QBChatDialogResult *res = (QBChatDialogResult *)result; 
    QBChatDialog *dialog = res.dialog; 
    NSLog(@"Dialog: %@", dialog); 

    QBChatHistoryMessageResult *res1 = (QBChatHistoryMessageResult *)result; 
    NSArray *messages = res1.messages; 
    [self.messages addObjectsFromArray:[messages mutableCopy]]; 
    [self.messagesTableView reloadData]; 
} 
} 

得到錯誤=

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '**setObjectForKey: object cannot be nil (key: chat_dialog_id)' 

*** First throw call stack: 

    **(
    0 CoreFoundation      0x036bcdf6 __exceptionPreprocess + 182 
    1 libobjc.A.dylib      0x03346a97 objc_exception_throw + 44 
    2 CoreFoundation      0x035b019c -[__NSDictionaryM 
    setObject:forKey:] + 940 
    3 CoreFoundation      0x0362c7f0 -[NSMutableDictionary 
    setObject:forKeyedSubscript:] + 48 
    4 vChat        0x00033853 -[QBCMessageGetQuery setParams:] + 243 
    5 vChat        0x0008c415 -[QBQuery setupRequest:] + 133 
    6 vChat        0x0008c11f -[QBQuery 
    performInBgAsyncWithDelegate:] + 511 
    7 Foundation       0x02f4cb57 -[NSThread main] + 76 
    8 Foundation       0x02f4cab0 __NSThread__main__ + 1326 
    9 libsystem_pthread.dylib    0x03eedecf _pthread_body + 138 
    10 libsystem_pthread.dylib    0x03eede45 _pthread_body + 0 
    11 libsystem_pthread.dylib    0x03eebf0e thread_start + 34 
)** 
libc++abi.dylib: terminating with uncaught exception of type NSException** 
+0

你使用哪種版本的iOS SDK的?我建議你更新到最新的2.0.10。我記得早期版本 – 2014-10-23 07:21:40

+1

@IgorKhomenko這個問題我已經更新到2.0.10,但存在相同的概率.. – NSArray 2014-10-24 11:38:02

回答

0

看起來你的問題是與獲取信息查詢

NSMutableDictionary *extendedRequest = [NSMutableDictionary new]; 
extendedRequest[@"limit"] = @(100); 
NSString *dialogID = @"5406cba6efa357825a00002b"; 
[QBChat messagesWithDialogID:dialogID extendedRequest:extendedRequest delegate:self]; 

我想這dialogID是零,你的情況,這就是爲什麼你會得到一個異常

Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '**setObjectForKey: object cannot be nil (key: chat_dialog_id)' 

的dialogID不應該是零

+0

是我的dialodID是零但是我得到零,我已經認證 – NSArray 2014-10-25 12:08:48