First post. I have gone through Steve's 6 day boot camp and it slingshotted me into some great development. However, I am encountering this error which I have googled and read documentation but, just can't get clear of.
Error Domain=NSCocoaErrorDomain Code=261 "The operation couldn’t be completed. (Cocoa error 261.)"
I am trying to load a local HTML file into a UIWebView with an NSString stringWithContentsOfFile call. I see the 261 error has to do with Characters but, none of my HTML has anything other than chars/numbers and formatting.
Here is my code:
Products.m - i grab a Products.plist out of the Products directory to get a dictionary of the file names. In this same Products directory I have all my HTML files. The path is working because I did a test in another file to see if the file was present before working with this. The loadHTMLString:baseURL has to have that baseURL: argument so I just use /. I can't even print the webProductContent out to NSLog, it just comes back as null.
NSString *dictPath = [[NSBundle mainBundle] pathForResource:@"Products" ofType:@"plist" inDirectory:@"productFiles/"];
NSDictionary *products = [NSDictionary dictionaryWithContentsOfFile:dictPath];
NSString *fileName = [products objectForKey:[self title]];
NSError *errorMsg = [[NSError alloc] init];
NSString *webProductPath = [[NSBundle mainBundle] pathForResource:fileName ofType:@"html"];
NSString *webProductContent = [NSString stringWithContentsOfFile:webProductPath encoding:NSUTF8StringEncoding error:&errorMsg];
NSURL *pathToHTML = [NSURL URLWithString:@"/"];
[productWeb loadHTMLString:webProductContent baseURL:pathToHTML];
Here is my HTML file. I was done in Dreamweaver with UTF-8 encoding:
<strong>SIPware Residential Voice-over-Broadband</strong>
The RadiSys SIPware Residential Voice-over-Broadband (VoBB) service is a turnkey, software-based solution designed for service providers deploying primary and secondary line voice services over broadband networks. Subscribers can make IP-originated calls to other IP phones or to the PSTN, and receive calls through a PSTN-provisioned phone number. Service providers can deploy the service using either prepaid or postpaid billing mechanisms to flexibly match their market strategy and business model. SIPware Residential VoBB offers service providers a complete, off-the-shelf solution for delivering profitable residential voice services—rapidly and cost-effectively.</p>
RadiSys SIPware Residential Voice-over-Broadband (VoBB) is a robust IP voice solution with a wide range of popular “star code” features—from Caller ID and Call Waiting to Anonymous Call Blocking and Voicemail.</p>
I even went so far as to strip everything out of the HTML file and just put in one line with no formatting and still nothing. The reason that I do it this way is for the formatting, underlines, bolds, lists, etc...