question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iOS: stringByRemovingPercentEncoding breaks

See original GitHub issue

In RNSound.m, my AVAudioPlayer errors out because of this line of code: fileNameUrl = [NSURL URLWithString: [fileName stringByRemovingPercentEncoding]]; if I change it to fileNameUrl = [NSURL URLWithString: fileName]; it works fine.

However, I’m uncomfortable changing this code. Is there a reason for using stringByRemovingPercentEncoding ? I’m try to play audio from my aws s3 bucket.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
alfonsodevcommented, Aug 17, 2017

I agree because this string replacement the module can not play from Firebase Storage Services which uses %2F in file names.

1reaction
anthonyjoesephcommented, Jul 18, 2017

Why is this library written to explicitly remove percent encoding on network uris, when NSData seems to require percent encoding?

Local uris also have their percent encoding removed. Though that works, it seems unnecessary, since fileURLWithPath adds percent encoding back on again.

And why is this only in the code for ios, not android? The code for Android reformats local uris (in sound.js) but not network uris.

A side note - [NSData dataWithContentsOfURL:] is deprecated because it’s synchronous, and should be replaced with the asynchronous [[[NSURLSession sharedSession] dataTaskWithURL:_ completionHandler:_] resume] .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Having trouble with "removingPercentEncoding" in Swift and ...
I am having difficulty getting "removingPercentEncoding" working for an NSString in Cocoa and for String in Swift. For instance I have a text...
Read more >
URL Encoding issue in swift ios - Stack Overflow
Your URL is already percent-encoded. If you encode it again, the percent parts will be encoded twice, giving an invalid URL.
Read more >
Bountysource
iOS : stringByRemovingPercentEncoding breaks.
Read more >
Deep Linking for iOS - Braze
iOS 9 introduced a breaking change affecting web URLs embedded in in-app ... an encoded link, use the NSString method stringByRemovingPercentEncoding .
Read more >
[Solved]-how to add empty space in string ios - appsloveworld
See Also – stringByAddingPercentEncodingWithAllowedCharacters: – stringByReplacingPercentEscapesUsingEncoding: – stringByRemovingPercentEncoding.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found