I'm working on an API client for a REST service that uses a custom token-based authentiation scheme. The app hits a specificed authentication endpoint with a username and password, said endpoint returns a token that's good for X amount of time, and the app passes that token along with every subsequent request. When that token expires, we start over.Most literature out there tells me to manually set the Authorization header on my request, but official Apple documentation discourages this, as that header is meant to be 'owned' by the built-in HTTP loading system. That said, official documentation on the 'correct' way to do this is shockingly lacking, and the standard didReceiveChallenge callbacks seem better suited for non-custom Basic/Digest/etc authentication schemes. One thought I had was registering my own URLProtocol subclass to handle our custom flow. However, while I haven't had a chance to sit down and take a crack at that yet, my understanding from skimming these forums is that it's suffering from some bit-rot right now, so it 'might' (?) not be the best choice. That, and it's also not clear to me whether the rules around the Authorization header change when a custom URLProtocol is in play.So, community (paging eskimo in particular!), what's the correct way for me to go about this?
Post
Replies
Boosts
Views
Activity
We have an Aggregate target with a custom Run Script build phase that consumes a JSON file in the project and outputs a .swift file and an .xcassets folder. However, getting our primary app target to see and include these output files has required some hacky measures (that I'd rather not delve into), and I'm wondering if there's something I'm missing.
What's the defacto way of ensuring that Build Phase output files get included as sources file in an app build?
In Xcode 14 Beta 5, I'm using an XcodeBuildToolPlugin to generate Named Color assets. While accessing these assets from code is working as expected, I don't see these generated Named Colors in Interface Builder. Is this expected behavior, or is this something that needs fixing?
How can I extract the localized field labels on per-CNPostalAddress instance? For example, if I the following:
let address1 = CNMutablePostalAddress()
address1.isoCountryCode = "US"
let address2 = CNMutablePostalAddress()
address2.isoCountryCode = "CA"
How can I extract the State string from address1 and Province string from address2?