2 * Copyright (c) 2019 Apple Inc. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #if !defined(__i386__)
18 #include "bundle_utilities.h"
20 #import <CoreServices/CoreServicesPriv.h>
21 #import <CoreUtils/SoftLinking.h>
23 SOFT_LINK_FRAMEWORK_EX(Frameworks, CoreServices);
24 SOFT_LINK_CLASS_EX(CoreServices, LSBundleRecord);
25 #define LSBundleRecordSoft getLSBundleRecordClass()
27 SOFT_LINK_FRAMEWORK_EX(Frameworks, Foundation);
28 SOFT_LINK_CLASS_EX(Foundation, NSString);
29 #define NSStringSoft getNSStringClass()
31 bool bundle_sdk_is_ios14_or_later(void)
34 #define MIN_SDK_VERSION "10.16"
36 #define MIN_SDK_VERSION "7.0"
38 #define MIN_SDK_VERSION "14.0"
42 if (LSBundleRecordSoft && NSStringSoft) {
44 id rec = [LSBundleRecordSoft bundleRecordForCurrentProcess];
46 NSString * min_vers = [NSStringSoft stringWithUTF8String:MIN_SDK_VERSION];
47 NSComparisonResult compare_result = [[rec SDKVersion] compare:min_vers options:NSNumericSearch];
48 result = ((compare_result == NSOrderedSame) || (compare_result == NSOrderedDescending));
53 return (result != NO);