What is the equivalent of NSString.stringWithContentsOfURL in Monotouch?
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));
精彩评论