Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell

NSString *filePath = [[NSBundle mainBundle] pathForResource: studyDetails.detailText ofType:@"html" inDirectory:@"HTMLContent"];
NSAssert(filePath, @"Expecting file \"%@.html\" to be present in the \"HTMLContent\" directory, but didn't find it", studyDetails.detailText);
NSURL *targetURL = [NSURL URLWithString:filePath];
NSString *encodingFilePath = [filePath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *targetURL = [NSURL URLWithString:encodingFilePath];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we used fileURLWithPath: ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, for example: if the Bundle Identifier contain spaces or special characters surely will not Appear the HTML in the WebView, because the NSURL can not be built, it Shall be made a null NSURL. So is you need to use Encoding.

=) Use it:
NSURL *targetURL = [NSURL fileURLWithPath: filePath];

NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webViewCell.webView loadRequest:request];

Expand Down