gpt4 book ai didi

iphone - 'NSString' 没有可见的@interface 声明选择器 'appendData'

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

就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the help center寻求指导。




9年前关闭。




我正在尝试异步调用服务器(ARC -on):

NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:request delegate:self];

if (theConnection) {
content = [NSMutableData data];
NSLog(@"responseData from setup.php: %@", content);
} else {
// Inform the user that the connection failed.
NSLog(@"error from server response in set up");
}

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
NSLog(@"connection did receive response");
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[content appendData:data];

NSLog(@"connection did receive data");
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSLog(@"connection did finish load");
NSLog(@"Succeeded! Received %@ bytes of data",receivedData);
}

但我在从服务器获取内容时遇到问题:-
在 didReceiveData 函数中,出现以下错误:-
“NSString”没有可见的@interface 声明选择器“appendData”

有人可以建议我哪里错了吗?

最佳答案

在接口(interface)部分的 .h 文件中,请声明以下内容

NSMutableData *content;

关于iphone - 'NSString' 没有可见的@interface 声明选择器 'appendData',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12418715/

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