Hi,
The article https://developer.apple.com/news/?id=g9ejcf8y "Identity Pinning: How to configure server certificates for your app" from 2021-01-14 looks really promising.
However, I cannot get the settings to have any effect on iOS 14.3 (Xcode 12.3).
I tested with NSPinnedCAIdentities and Charles Proxy as well as an incorrect RootCA key. In both cases the requests were successful, Charles was able to decrypt the traffic.
Questions that come to my mind: Where is the detailed documentation of the keys?
Which platforms/versions are supported?
Thanks and kind regards,
Lars
Post
Replies
Boosts
Views
Activity
Hi,
We are getting crashes in code that has worked fine for the last 1.5 years and which by all means looks legal to us.
Since Upgrading to Xcode 13.3 the following two code examples crash on iPhone & Simulator and MacOS.
They work fine when compiling with Xcode 13.2.1:
fileprivate typealias Closure = () -> Void
func crash1() {
let closure1: Closure? = nil
let closure2: Closure? = nil
let closure3: Closure? = nil
print("Closures: \(String(describing: closure1)), \(String(describing: closure2)), \(String(describing: closure3))")
let closure = closure1 ?? closure2 ?? closure3
print("\(#line): \(String(describing: closure))")
closure?() // <- EXC_BAD_ACCESS
assert(closure == nil)
}
func crash2() {
let closure1: Closure? = nil
let closure2: Closure? = nil
let closure3: Closure? = { }
print("Closures: \(String(describing: closure1)), \(String(describing: closure2)), \(String(describing: closure3))")
let closure = closure1 ?? closure2 ?? closure3
print("\(#line): \(String(describing: closure))")
closure?() // <- EXC_BAD_ACCESS
assert(closure != nil)
}
The resulting closure has a value of Optional((Function)) in both cases, but it is corrupted, i.e. crashes on use. Please not the it should be nil in the first example, after all.
Note: The Code apparently works in a playground (albeit sometimes the playground simply hangs), but not in an iOS (UIKit/SwiftUI) or MacOS (SwiftUI or command line tool) project.
No crashes when:
a) using only two optionals in a row:
let closure = closure1 ?? closure2
or b) when using parentheses:
let closure = (closure1 ?? closure2) ?? closure3
Known issue?
Radar?
Any ideas?
Thanks,
Lars