I am trying to build a URL string that will be passed to UIWebView object. Up until now I have been pointing to remote files and have now moved the files into the main bundle.
I imported my files using the “create folder reference” option and want to point to the index.html file inside of a folder named ‘html’.
I need to append hashtags to the URL generated by the code below but keep getting this error:
-[NSURL stringByAppendingString:]: unrecognized selector sent to instance
I can’t figure out why when casting my variables as a NSString I am receiving this error when trying to append to it.
Here is my code:
NSInteger rowNumber = indexPath.row;
NSInteger metroRank = rowNumber+1; //sorted by rank, adding one because of zero-based array
NSString *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"html"]];
NSString *urlSuffix = [NSString stringWithFormat:@"#pg=metro&view=%d", metroRank];
NSString *metroViewURL = [url stringByAppendingString:urlSuffix];
When the above code hits ‘stringByAppendString’ that is when I receive the error.
Convert it to a NSString first: