Addresponse - 仅添加到内存(XCode)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14579748/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 02:39:41  来源:igfitidea点击:

Addresponse - adding to memory only (XCode)

objective-cxcodecocoa-touchcocoa

提问by Anders Kortegaard

I'm trying to connect my project to a php file but every time this shows:

我正在尝试将我的项目连接到一个 php 文件,但每次都显示:

ADDRESPONSE - ADDING TO MEMORY ONLY

I have never seen it before. this is the code i Use:

我以前从未见过。这是我使用的代码:

//Gets the php
FindURL = [NSString stringWithFormat:@"http://domain.com/Myfile.php?username=%@", Username.text];
// to execute php code
URLData = [NSData dataWithContentsOfURL:[NSURL URLWithString:FindURL]];

// to receive the returend value
DataResult = [[NSString alloc] initWithData:URLData encoding:NSUTF8StringEncoding];

NSLog(@"%@",DataResult);

What can i do?

我能做什么?

Thanks in advance

提前致谢

Update code:

更新代码:

- (IBAction)UpdateList:(id)sender{



    NSURLRequest *request=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://domain.com/Myfile.php"]
        cachePolicy:NSURLRequestUseProtocolCachePolicy
        timeoutInterval:15.0];
    NSURLConnection *Connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
    if (Connection) {
        //Connect
    }else{
        //Error
    }

}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{
    DataResult = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

    NSLog(@"%@", DataResult);

}

回答by Toubey

I've had the same issue - check out the following, this might help you: Log Messages I didn't asked for in Xcode 4.5 with iOS 6.0

我遇到了同样的问题 - 查看以下内容,这可能对您有所帮助: Log Messages I didn't ask for in Xcode 4.5 with iOS 6.0

I haven't found a solution so far, but since I now know that this Log is produced by the OS, I no longer look for its origin in my source :)

到目前为止我还没有找到解决方案,但由于我现在知道这个日志是由操作系统生成的,我不再在我的源中寻找它的来源:)

回答by Matthew Quiros

I got this log by making an NSURLRequestto an invalid URL. My app is supposed to show a UIAlertViewwhen it catches an error on the server side, so I asked our system admin to take our entire site down so I can see what happens. He declined my request, so I typed random letters and put a .comat the end of the request URL.

我通过创建NSURLRequest一个无效的 URL得到了这个日志。我的应用程序UIAlertView在服务器端发现错误时应该显示,所以我要求我们的系统管理员关闭我们的整个站点,以便我看看会发生什么。他拒绝了我的请求,所以我输入了随机字母并.com在请求 URL 的末尾加上了一个。

Turns out we have an internal test server that doesn't seem to be accessible from my WiFi connection, so when I changed the URL to that instead, the log stopped appearing.

原来我们有一个内部测试服务器,它似乎无法通过我的 WiFi 连接访问,所以当我将 URL 更改为该 URL 时,日志停止出现。