8
4
|
I am trying to use initWithContentsOfURL:encoding:error: like this :
I get a empty my_string variable. I tried the initWithContentsOfURL: method (which is deprecated in iOS 2.0) and I get the content of my page. But I still need to specify a encoding language. What's wrong ? Thanks :) |
||||||||
|
20
|
the encoding of your file is probably not UTF8. If you don't know the encoding of your file, you could try this method:
you have to pass a pointer to a NSStringEncoding, like you did with error.:
after this your encoding is present in the encoding variable. If you are not interested in the used encoding, I guess you could pass NULL as pointer as well. |
||||||||||||||||||||
|
4
|
Why not use a request and connection to get the info back in an NSData object? Something like this:
and then in your connection:didRecieveData delegate method, put something like this
and then once the connection is finished loading convert the data to a string:
Not the most straightforward method, but that should get you your XML string. Also if you need to parse the XML once you get it back, you can directly pass the responseData to an NSXMLParser without any conversion. :) |
||||
|
1
|
You can modify your webpage by adding |