Xcode 6 error 'URLWithString' is unavailable?
来源:互联网 发布:手机拍电影的软件 编辑:程序博客网 时间:2024/04/29 02:55
Please help a newbie here. I'm sure this is stupid simple.
I'm following along and learning Xode nicely, but I'm stumped on a basic connection to a URL:
var text = textField.textvar url = NSURL.URLWithString(text)var request = NSURLRequest(URL: url)webView.loadRequest(request)
I'm getting the following error for the second line above:
'URLWithString' is unavailable: use object construction 'NSURL(string:)'
(code is part of a brief tutorial at: http://www.lynda.com/articles/build-first-ios-app-swift)
Answer:
Apple changed some of the Swift methods recently, so I've found a few Swift tutorials to be out of date just like what you've encountered. Luckily, it's telling you exactly what to do instead:
var url = NSURL(string:text)
0 0
- Xcode 6 error 'URLWithString' is unavailable?
- Xcode-Cocoa “release is unavailable” Error
- [iphone][xcode]NSURL urlwithstring
- [iphone][xcode]NSURL urlwithstring
- HTTP Error 503. The service is unavailable.
- HTTP Error 503. The service is unavailable
- HTTP Error 503. The service is unavailable
- HTTP Error 503. The service is unavailable
- HTTP Error 503. The service is unavailable
- HTTP Error 503. The service is unavailable
- HTTP Error 503. The service is unavailable
- HTTP Error 503. The service is unavailable.
- HTTP Error 503. The service is unavailable.
- SharePoint - Error: Service Unavailable HTTP Error 503. The service is unavailable
- SharePoint - Error: Service Unavailable HTTP Error 503. The service is unavailable
- 邂逅 HTTP Error 503。The service is unavailable
- HTTP Error 503,The service is unavailable错误
- iis HTTP Error 503. The service is unavailable.
- css3动画效果
- PorterDuffXfermode 模式示例
- Java接口和抽象类的区别
- js模板引擎入门(附有项目实例)
- Oracle Instant Client(即时客户端) 安装与配置
- Xcode 6 error 'URLWithString' is unavailable?
- Java-StringCharacterIterator简单的用法
- HDU 1047 Integer Inquiry 可做大数模板
- C++重命名文件-code
- spring框架学习(三)junit单元测试
- MD5加密(16位)
- Debugging DirectX 11 shaders with Visual Studio
- XZ压缩
- JAVA.SWT/JFace: SWT基本组件之列表框(List)