'NSString'没有可见的@interface声明选择器'appendData' [英] No visible @interface for 'NSString' declares the selector 'appendData'

查看:37
本文介绍了'NSString'没有可见的@interface声明选择器'appendData'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to call the server asynchronously (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"

But i am having problem getting the content from the server:- in didReceiveData function, following error is coming:- No visible @interface for 'NSString' declares the selector 'appendData'

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

Can anybody suggest me where I could be wrong?

推荐答案

在界面部分的.h文件中,请声明以下内容

in your .h file in the interface section please declare the following

NSMutableData *content;

这篇关于'NSString'没有可见的@interface声明选择器'appendData'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆