Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 92e4c57

Browse files
authored
Fix bug
1 parent d654a5d commit 92e4c57

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

Sources/prostore/install/installApp.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,17 @@ public func installApp(from ipaURL: URL) throws {
412412
if status == errSecSuccess,
413413
let arr = items as? [[String: Any]],
414414
let first = arr.first,
415-
let identityRef = first[kSecImportItemIdentity as String] as! SecIdentity
415+
if let identityRef = first[kSecImportItemIdentity as String] as? SecIdentity {
416+
// use identityRef as before
417+
if let secId = sec_identity_create(identityRef) {
418+
tlsIdentity = secId
419+
tlsEnabled = true
420+
} else {
421+
print("sec_identity_create failed; falling back to HTTP")
422+
}
423+
} else {
424+
print("Could not extract SecIdentity from PKCS12; falling back to HTTP")
425+
}
416426
{
417427
// convert to sec_identity_t for sec_protocol_options_set_local_identity()
418428
// sec_identity_create is available on modern Apple SDKs — returns sec_identity_t?

0 commit comments

Comments
 (0)