2015-01-09 2 views
0

채팅 응용 프로그램과 XMPPFramework 사용이 오류가 발생합니다. 메시지 SendButton 아래에 주어진대로 동작합니다. plz이 다음에 plz을 말해 주면 도움이됩니다 .......... .... 출력에서 ​​오류가채팅 응용 프로그램 사용 XMPPFramework이 오류가 발생합니다.

- (IBAction)sendAction:(id)sender 
      { 
       if([_chatTextField.text length] > 0) 
       { 
        NSString* po = getUser.ofUser; 
        bubbleTable.typingBubble = NSBubbleTypingTypeNobody; 
        NSBubbleData *messageBubble = [NSBubbleData dataWithText:_chatTextField.text date:[NSDate dateWithTimeIntervalSinceNow:0] type:BubbleTypeMine]; 
        [bubbleData addObject:messageBubble]; 
        [bubbleTable reloadData]; 
        [bubbleTable scrollBubbleViewToBottomAnimated:YES]; 


        [[QuoteMessageController SharedInstance] SendChatMessageTo:getUser.account withContent:_chatTextField.text toUserId:[NSString stringWithFormat:@"%ld", (long)getUser.Id] andOFId:po andVerifyKey:chatMessageKey]; 
       } 

울부 짖는 소리 주어진 >>>>>>

 *** First throw call stack: 
     (
      0 CoreFoundation      0x000000010e18ff35 __exceptionPreprocess + 165 
      1 libobjc.A.dylib      0x000000010da7bbb7 objc_exception_throw + 45 
      2 CoreFoundation      0x000000010e18fe6d +[NSException raise:format:] + 205 
      3 Foundation       0x000000010ba211f8 -[NSString stringByAppendingString:] + 96 
      4 SourceSage       0x000000010ae0c939 +[SSWriteReadInDb writeQuotesTable:UserImageUrl:UserId:OfUser:] + 409 
      5 SourceSage       0x000000010adb8d56 -[QuoteMessageController SendChatMessageTo:withContent:toUserId:andOFId:andVerifyKey:] + 2454 
      6 SourceSage       0x000000010ad6ac30 -[SSChatViewController sendAction:] + 752 
      7 UIKit        0x000000010beb48be -[UIApplication sendAction:to:from:forEvent:] + 75 
      8 UIKit        0x000000010bfbb410 -[UIControl _sendActionsForEvents:withEvent:] + 467 
      9 UIKit        0x000000010bfba7df -[UIControl touchesEnded:withEvent:] + 522 
      10 UIKit        0x000000010befa308 -[UIWindow _sendTouchesForEvent:] + 735 
      11 UIKit        0x000000010befac33 -[UIWindow sendEvent:] + 683 
      12 UIKit        0x000000010bec79b1 -[UIApplication sendEvent:] + 246 
      13 UIKit        0x000000010bed4a7d _UIApplicationHandleEventFromQueueEvent + 17370 
      14 UIKit        0x000000010beb0103 _UIApplicationHandleEventQueue + 1961 
      15 CoreFoundation      0x000000010e0c5551 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 
      16 CoreFoundation      0x000000010e0bb41d __CFRunLoopDoSources0 + 269 
      17 CoreFoundation      0x000000010e0baa54 __CFRunLoopRun + 868 
      18 CoreFoundation      0x000000010e0ba486 CFRunLoopRunSpecific + 470 
      19 GraphicsServices     0x000000010fe7c9f0 GSEventRunModal + 161 
      20 UIKit        0x000000010beb3420 UIApplicationMain + 1282 
      21 SourceSage       0x000000010ae02893 main + 115 
      22 libdyld.dylib      0x000000010ee2e145 start + 1 
      23 ???         0x0000000000000001 0x0 + 1 
     ) 
     libc++abi.dylib: terminating with uncaught exception of type NSException 
     (lldb) 
+0

추적 에러 때문에 QuoteMessageController SendChatMessageTo의 발생 나타난다 : withContent : toUserId : andOFId : andVerifyKey : 상기 메시지 [SSWrit에 이르게 eReadInDb writeQuotesTable : UserImageUrl : UserId : OfUser :] 일부 문자열이 예상 된 형식이 아닐 수 있습니다. 버그는 전달 된 바람직하지 않은 매개 변수로 인한 것일 수 있습니다. 또한 XMPPFramework에 익숙하지 않지만이 도메인에서의 경험으로 인해 이러한 라이브러리에는 발생하기 쉬운 버그가있을 수 있으므로 가능한 경우 상황이 필요할 때 주저하지 말고 주저하지 마십시오. –

+0

확인해 보겠습니다.이 XMPPFramework에 새로운 기능이 추가되었습니다. –

+0

2015-01-12 11 : 50 : 21.701 SourceSage [808 : 31203] 사용자 계정 (null) 2015-01-12 11 : 50 : 21.701 SourceSage [808 : 31203] chat Textfieldsdfd 2015-01-12 11 : 50 : 21.701 SourceSage [808 : 31203] 2015-01-12 11 : 50 : 21.701 SourceSage [808 : 31203] getUserID0 2015-01 -12 11 : 50 : 21.702 SourceSage [808 : 31203] chat messgKey2365891 2015-01-12 11 : 53 : 27.318 SourceSage [808 : 31203] dbPath :/사용자/관리/라이브러리/개발자/CoreSimulator/장치/8454248E-7AE1 -4B91-B706-3405E889DAB2/데이터/컨테이너/데이터/응용 프로그램/08CC88B9-E43D-4F3E-A56A-2717475B0AAD/문서/Recipes/SourceSageDB.db 248E-7AE1-4B91-B706- –

답변

0

당신의 스택 트레이스의이 부분을보고 후 :

2 CoreFoundation  0x000000010e18fe6d +[NSException raise:format:] + 205 
3 Foundation   0x000000010ba211f8 -[NSString stringByAppendingString:] + 96 
4 SourceSage   0x000000010ae0c939 +[SSWriteReadInDb writeQuotesTable:UserImageUrl:UserId:OfUser:] + 409 
5 SourceSage   0x000000010adb8d56 -[QuoteMessageController SendChatMessageTo:withContent:toUserId:andOFId:andVerifyKey:] + 2454 
6 SourceSage   0x000000010ad6ac30 -[SSChatViewController sendAction:] + 752 

문자열이 문자열에 추가 된 후에 예외가 발생합니다. 대개 nil을 문자열에 추가하면 발생합니다. 아래 방법으로 보내는 NSString 인수 중 하나가 nil 인 것으로 추측됩니다.

[[QuoteMessageController SharedInstance] SendChatMessageTo:getUser.account 
    withContent:_chatTextField.text 
    toUserId:[NSString stringWithFormat:@"%ld", (long)getUser.Id] 
    andOFId:po 
    andVerifyKey:chatMessageKey]; 

이 사실 경우에 해당하는지 확인 중 여기에 중단 점을 설정하고 모든 값을 확인하거나이 메서드를 호출하기 전에 다음에 추가하려면 다음

NSLog(@"%@", getUser.account); 
NSLog(@"%@", _chatTextField.text); 
NSLog(@"%@", po); 
NSLog(@"%@", [NSString stringWithFormat:@"%ld", (long)getUser.Id]); 
NSLog(@"%@", chatMessageKey); 

내가 돈을 ' 매개 변수가 실제로 무엇인지 알기 때문에 NSLog을 제거하여 NSString이 아닌 변수를 찾아야합니다. 이러한 로그 중 하나가 nil 또는 null (콘솔이 출력 할 내용을 잊어 버렸음)으로 돌아 오면 문제를 발견했습니다. 반드시 필요하지는 않은 인수라면 빈 대신 NSString을 전달해야합니다. 나는 보통 삼자로 이것을한다. @""을 사용, 그렇지 않으면,이 기본적으로 말한다 이렇게

[[QuoteMessageController SharedInstance] SendChatMessageTo:getUser.account 
    withContent:_chatTextField.text ?: @"" 
    toUserId:[NSString stringWithFormat:@"%ld", (long)getUser.Id] 
    andOFId:po 
    andVerifyKey:chatMessageKey]; 

_chatTextField.text에 해당하는 경우, (그것이 nill없는 경우에 동일시 것이다), 그 값을 사용 : 그래서 가정 범인이 나는대로 그 인수를 전달할 것 _chatTextField.text입니다

EDIT :

스택에서
- (IBAction)sendAction:(id)sender 
{ 
    if([_chatTextField.text length] > 0) 
    { 
     NSString* po = getUser.ofUser ?: @""; 
     NSString *acct = getUser.account ?: @""; 
     bubbleTable.typingBubble = NSBubbleTypingTypeNobody; 
     NSBubbleData *messageBubble = [NSBubbleData dataWithText:_chatTextField.text date:[NSDate dateWithTimeIntervalSinceNow:0] type:BubbleTypeMine]; 
     [bubbleData addObject:messageBubble]; 
     [bubbleTable reloadData]; 
     [bubbleTable scrollBubbleViewToBottomAnimated:YES]; 


     [[QuoteMessageController SharedInstance] SendChatMessageTo:acct withContent:_chatTextField.text toUserId:[NSString stringWithFormat:@"%ld", (long)getUser.Id] andOFId:po andVerifyKey:chatMessageKey]; 
} 
+0

2015-01-12 11:38 58.035 SourceSage [673 : 20203] *** 캐치되지 않은 예외 'NSInvalidArgumentException'으로 인해 응용 프로그램을 종료합니다. 이유 : '*** - [__ NSCFConstantString stringByAppendingString :] : nil arguments' *** 첫 번째 호출 스택 스택 : ( \t CoreFoundation에서 0x0000000108073f35 __exceptionPreprocess + 165 \t 1 libobjc.A.dylib 0x000000010795fbb7 objc_exception_throw + 45 \t 0x0000000108073e6d CoreFoundation에서 2 + [NSException 인상 : 형식 :] + 205 \t 3 재단 –

+0

2015년 1월 12일 11 : 50 : 21.701 SourceSage [808 : 31203] 사용자 계정 (null) 2015-01-12 11 : 50 : 21.701 SourceSage [808 : 31203] chat Textfieldsdfd 2015-01-12 11 : 50 : 21.701 SourceSage [8 08 : 31203] po (null) 2015-01-12 11 : 50 : 21.701 SourceSage [808 : 31203] getUserID0 2015-01-12 11 : 50 : 21.702 SourceSage [808 : 31203] 채팅 messgKey2365891 –

+0

@NayeemuddinShaik 그래서 바로 거기 문제. '사용자 계정'과'po'는 null입니다. 그 값은 null이 될 수 없습니다. 이것이 충돌의 원인입니다. – Chris

관련 문제