由于未捕获的异常而终止应用 ' NSInvalidArgumentException',原因:' *** - [__ NSCFConstantString stringByAppendingString:]:nil参数' 我得到这个错误帮助我..
- (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];
NSLog(@"getuserAccount:%@", getUser.account);
NSLog(@"TextField:%@", _chatTextField.text);
NSLog(@"Po:%@", po);
NSLog(@"UserID:%@", [NSString stringWithFormat:@"%ld", (long)getUser.Id]);
NSLog(@"chatMessageKey:%@", chatMessageKey);
[[QuoteMessageController SharedInstance] SendChatMessageTo:getUser.account withContent:_chatTextField.text toUserId:[NSString stringWithFormat:@"%ld", (long)getUser.Id] andOFId:po andVerifyKey:chatMessageKey];
}
//[self StopInteraction];
}
outPut Iam得到了......
> userAccount:(null)
> 2015-01-12 19:09:26.050 SourceSage[6842:737878] TextField:haii
> 2015-01-12 19:09:26.051 SourceSage[6842:737878] Po:(null)
> 2015-01-12 19:09:26.052 SourceSage[6842:737878] UserID:0
> 2015-01-12 19:09:26.052 SourceSage[6842:737878] chatMessageKey:2365891
> 2015-01-12 19:09:44.240 SourceSage[6842:737878] dbPath:/var/mobile/Containers/Data/Application/C06E4910-88B7-46BF-A7A9-8FBDCDA44B67/Documents/Recipes/SourceSageDB.db
> 2015-01-12 19:09:44.264 SourceSage[6842:737878] dbPath:/var/mobile/Containers/Data/Application/C06E4910-88B7-46BF-A7A9-8FBDCDA44B67/Documents/Recipes/SourceSageDB.db
> 2015-01-12 19:09:44.273 SourceSage[6842:737878] *** Terminating app due to uncaught exception
> 'NSInvalidArgumentException', reason: '*** -[__NSCFConstantString
> stringByAppendingString:]: nil argument'
> *** First throw call stack:
> (0x2ce265f7 0x3a560c77 0x2ce2653d 0x2da749b3 0x1224b9 0xd2465 0x85569 0x302ff197 0x302ff139 0x302e9d1d 0x302feb69 0x302fe843
> 0x302f8151 0x302ce8c5 0x30542373 0x302cd307 0x2cdecfd7 0x2cdec3eb
> 0x2cdeaa69 0x2cd37b31 0x2cd37943 0x340f0051 0x3032d6f1 0x118fd9
> 0x3aafcaaf)
> libc++abi.dylib: terminating with uncaught exception of type NSException
> (lldb)
答案 0 :(得分:2)
日志确切地说NSString* po = getUser.ofUser;
返回null
或nil
值。
您将此nil
参数传递给方法[[QuoteMessageController SharedInstance] SendChatMessageTo: withContent: toUserId: andOFId:po andVerifyKey:];.