Skip to content

Commit f27b7f3

Browse files
gezihuzikornelski
authored andcommitted
fix: Exclude macOS-only Keychain symbol for iOS compatibility
Inclusion of the `kSecMatchSubjectWholeString` symbol when compiling for iOS, which is not supported according to Apple's documentation, is prevented. Conditional compilation directives are added to ensure that builds targeted for iOS do not use macOS exclusive Keychain functionalities. This adjustment resolves a compilation failure encountered following an update of the 'rust-security-framework' dependency, thereby enhancing the cross-platform compatibility of the SDK.
1 parent f829e92 commit f27b7f3

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

security-framework-sys/src/item.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ extern "C" {
1313

1414
pub static kSecMatchTrustedOnly: CFStringRef;
1515
pub static kSecMatchCaseInsensitive: CFStringRef;
16+
#[cfg(target_os = "macos")]
1617
pub static kSecMatchSubjectWholeString: CFStringRef;
1718

1819
pub static kSecReturnData: CFStringRef;

security-framework/src/item.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,14 @@ impl ItemSearchOptions {
367367
));
368368
}
369369

370-
if let Some(ref subject) = self.subject {
371-
params.push((
372-
CFString::wrap_under_get_rule(kSecMatchSubjectWholeString),
373-
subject.as_CFType(),
374-
));
370+
#[cfg(target_os = "macos")]
371+
{
372+
if let Some(ref subject) = self.subject {
373+
params.push((
374+
CFString::wrap_under_get_rule(kSecMatchSubjectWholeString),
375+
subject.as_CFType(),
376+
));
377+
}
375378
}
376379

377380
if let Some(ref account) = self.account {

0 commit comments

Comments
 (0)