Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing URLWithString: by fileURLWithPath: #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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,7 @@ - (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];
NSURL *targetURL = [NSURL fileURLWithPath:filePath];
Copy link
Member

Choose a reason for hiding this comment

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

Missed stringByAddingPercentEscapesUsingEncoding:?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@YuanZhu-apple This code is correct, if we use fileURLWithPath: we do not need to use stringByAddingPercentEscapesUsingEncoding :, only fileURLWithPath already does everything.

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

Expand Down