开发者

What is the equivalent of NSString.stringWithContentsOfURL in Monotouch?

开发者 https://www.devze.com 2023-02-11 03:39 出处:网络
I\'m missing NSString开发者_开发知识库.stringWithContentsOfURL in Monotouch. Does it exist?Even easier:

I'm missing NSString开发者_开发知识库.stringWithContentsOfURL in Monotouch. Does it exist?


Even easier:

string msg = new WebClient ().DownloadString ("http://www.google.com");


[NSString stringWithContentsOfURL:] is not bound in monotouch.

You could invoke it manually like this:

var url = new NSUrl ("http://www.google.com/");
var str = (NSString) Runtime.GetNSObject (Messaging.IntPtr_objc_msgSend_IntPtr (Class.GetHandle ("NSString"), Selector.GetHandle ("stringWithContentsOfURL:"), url.Handle));
0

精彩评论

暂无评论...
验证码 换一张
取 消