gpt4 book ai didi

iOS : -[__NSCFDictionary _expandedCFCharacterSet]: error

转载 作者:行者123 更新时间:2023-12-01 17:12:10 27 4
gpt4 key购买 nike

我正在开发 iOS 应用程序。在一种情况下,我正在像这样向服务器发送电话号码和一些短信

- (void)postData:(NSString *)message :(NSString *)mobileno
{

NSLog(@"postData is called");
@try
{
NSString *urlString = [NSString stringWithFormat:@"http://anlgelist.commonshell.net/api/account"];
NSURL *url = [[NSURL alloc] initWithString:urlString];
NSMutableURLRequest *urlRequest1=[NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
NSMutableDictionary *postDictionary=[[NSMutableDictionary alloc]init];
[postDictionary setValue:message forKey:@"Message"];
[postDictionary setValue:mobileno forKey:@"MobileNumber"];
SBJsonWriter *jsonWriter = [SBJsonWriter new];
NSError *error = nil;
NSLog(@"~~~~~~~~ postDictionary is %@",postDictionary);

NSString * jsonDataString =[jsonWriter stringWithObject:postDictionary];

if ( ! jsonDataString )
{
NSLog(@"Error: %@", error);
}

NSData *requestData = [NSData dataWithBytes:[jsonDataString UTF8String] length:[jsonDataString length]];
[urlRequest1 setHTTPMethod:@"PUT"];
[urlRequest1 setValue:@"application/json" forHTTPHeaderField:@"content-type"];
[urlRequest1 setHTTPBody: requestData];
connection1 = [NSURLConnection connectionWithRequest:urlRequest1 delegate:self];

}
@catch (NSException *exception)
{
////NSLog(@"exception is %@",exception);

@throw exception;
}

}

我不断调用此 Web 服务来发送详细信息。但有时我收到以下错误并且应用程序崩溃。
<Error>: -[__NSCFDictionary _expandedCFCharacterSet]: unrecognized selector sent to instance 0x14fdf350

我以前没有遇到过这种错误。我用谷歌搜索但没有找到解决方案。

崩溃报告现为

enter image description here

最佳答案

我不确定它会正常工作,但在你的情况下,对象已经释放并且你尝试访问它,所以我更喜欢这个解决方案,请试试这个。

SBJsonWriter *jsonWriter = [[SBJsonWriter new]retain];

关于iOS : -[__NSCFDictionary _expandedCFCharacterSet]: error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22066698/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com