【问题标题】:Addresponse - adding to memory only (XCode)Addresponse - 仅添加到内存(XCode)
【发布时间】:2013-01-12 20:05:23
【问题描述】:

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

ADDRESPONSE - ADDING TO MEMORY ONLY

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

//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);

我能做什么?

提前致谢

更新代码:

- (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);

}

【问题讨论】:

标签: objective-c xcode cocoa-touch cocoa


【解决方案1】:

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

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

【讨论】:

  • 我也开始看到这些消息。我怀疑在我的情况下它与 Burstly(现在称为 SkyRocket)有关。你们在用 Burstly 吗?
  • 不,我没有使用 Burstly/SkyRocket。有人在 iOS7 中看到过这些消息吗?
  • 我刚刚在 Xcode 5 和 iOS 7 上看到了这个。这里没有 Burstly/SkyRocket。
【解决方案2】:

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

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

【讨论】:

  • “所以我要求我们的系统管理员关闭我们的整个网站,以便我看看会发生什么。他拒绝了我的请求”。哈哈。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-09-23
  • 1970-01-01
  • 2015-04-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多