Post

Replies

Boosts

Views

Activity

Localized CNPostalAddress field labels
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?
0
0
504
Apr ’23
Adding Run Script build phase ouptut files to target
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?
0
0
932
Oct ’21
URLSession Token Authentication: What's the 'correct' way to do it?
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?
4
3
8.8k
Oct ’17