什么是“stringWithContentsOfURL”替换目标C? [英] What is the "stringWithContentsOfURL" replacement for objective C?

查看:101
本文介绍了什么是“stringWithContentsOfURL”替换目标C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网上找到了一个使用stringWithContentsOfURL命令的教程,该命令从iPhone OS 3.0开始就被弃用了。但是我无法找到我的意思,以及如何实现它。

I found a tutorial on the net that uses the stringWithContentsOfURL command that is now deprecated as of iPhone OS 3.0. However I can't find out what I'm meant to use instead, and how to implement it.

以下是stringWithContentsOfURL行的代码,以备不时之需供参考。

Below is the code surrounding the stringWithContentsOfURL line in case you need it for reference.

NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv", 
     [addressField.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]];
NSArray *listItems = [locationString componentsSeparatedByString:@","];

谢谢。

推荐答案

已经替换为 stringWithContentsOfURL:编码:错误: stringWithContentsOfURL:usedEncoding:错误:

这篇关于什么是“stringWithContentsOfURL”替换目标C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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