-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios] Provide a custom NSURLSessionDelegate? #11888
Comments
Related to #12026 |
Regarding HTTP Basic Auth, Mapbox GL JS has a transformRequest option, see: mapbox/mapbox-gl-js#5021 As a possible alternative to a custom NSURLSessionDelegate and for feature parity, it would be nice if the iOS implementation also provides the same functionality. We could then use it to set a HTTP Basic Auth header on the tile requests. |
If I'm not mistaken, the iOS SDK offers that functionality as part of the MGLOfflineStorageDelegate. |
@sebastianludwig it return a |
Aaah, true - never mind 👍 |
We discussed doing something similar to A way to provide either an NSURLSessionDelegate or an NSURLProtocol would be nice indeed, especially for folks who need to customize caching behavior. /cc @kkaefer @julianrex |
Mapbox GL does its own caching and doesn't rely on Cocoa's built-in caching. We do this because we need to tightly control resource expiration and ensure that they don't get evicted for offline packs. |
Hi @datwelk , we do not have plans to implement this in the foreseeable future because of competing priorities that we think bring value to more Mapbox developers. We consider https://mapbox.github.io/top-issues/#!mapbox/mapbox-gl-native when setting our priorities. This page takes user reactions into account, so if you’d like to raise this issue on our priority list, please vote for it using the 👍 reaction. A next step for implementing this issue would be to lay out your design ideas here so we can make sure they’re compatible with the rest of our SDK design. |
Hi @lilykaiser, thanks for your reply. The top issue on that page is from October 31 2016, with most recent activity on February 12th 2018. Hence I can only conclude that there seems to be quite some time passing by without the top issue resolved - could you clarify how indicative of internal priorities this |
Hi @datwelk , the top issues list is a big part of how we gauge user interest on GitHub, it’s just that user interest is not the only factor that guides our choices. We also take into account the size of the project, feedback from internal teams, and strategic goals. We don’t get to work on as many top issues as we like, but we do consider how much users need them and try to work them into our roadmap. |
I'd be happy to implement the feature, all I need is a guiding strategy how to go about it. I know, that's still a lot to ask, especially taking the time for the PR feedback into account too. But still, please let me know if that changes anything for you. |
FWIW, for now we have worked around the limitation of not being able to set custom HTTP headers by implementing a local proxy server running on the iOS device. Tile requests specify headers encoded as a URL param to localhost, localhost transforms this param into HTTP headers and relays the request + response. |
Take a look at #13491 for one possible solution to this issue. |
I've accomplished adding headers by swizzling |
@JesseCrocker How did you do that? And it is cleaner than #13491? |
I dont know if swizzling is cleaner, but it will let you stay on a current release rather than having to use a custom build.
NSObject+DTRuntime is from https://github.com/Cocoanetics/DTFoundation/blob/develop/Core/Source/Runtime/NSObject%2BDTRuntime.m |
Thanks! I will continue to use #13491 for authentication. |
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
Any news on this? |
I have solved the issue with @JesseCrocker's attempt. Create an Extension for NSURLSessionConfiguration and add DTFoundation as Pod.
|
I want to use Mapbox GL with a tile server that uses HTTP Basic Authentication. For that, it would be nice to have a way to provide a
NSURLSessionDelegate
to theNSURLSession
used to download tiles.The text was updated successfully, but these errors were encountered: