Because my build machine is still using the Xcode 12.5 , So the UITabBar's scrollEdgeAppearance(which will not exist in the Xcode 12.5's SDK) will make the build fail even i'am using the @available to check .
if (@available(iOS 15.0, *)) {
UINavigationBarAppearance* navBarAppearance = [UINavigationBarAppearance new];
navBarAppearance.backgroundColor = [UIColor colorNamed:@"navbar_bg"];
[UINavigationBar appearance].standardAppearance = navBarAppearance;
[UINavigationBar appearance].scrollEdgeAppearance = navBarAppearance;
UITabBarAppearance* tabBarAppearance = [UITabBarAppearance new];
tabBarAppearance.backgroundColor = [UIColor colorNamed:@"second_bg"];
[UITabBar appearance].standardAppearance = tabBarAppearance;
[UITabBar appearance].scrollEdgeAppearance = tabBarAppearance;
[UITableView appearance].sectionHeaderTopPadding = 0;
}
So is it possible to do this kind of SDK checking in code ,when the build SDK is not the newest SDK , these code will not be involved to build? like this
if (BuilDSDK >= someversion)
{
[UITabBar appearance].scrollEdgeAppearance = tabBarAppearance;
}
This is by far the most popular way to try to hide one’s source code. It involves taking your code, using a custom made function to “encrypt” it somehow, and then putting it in an HTML file along with a function that will decrypt it for the browser. A User is able to view the source, however, it isn’t understandable.
It’s a set of software tools and programs used by developers to create applications for specific platforms. SDK tools will include a range of things, including libraries, documentation, code samples, processes, and guides that developers can use and integrate into their own apps.
In this case, go back to the SDK meaning: it’s a development kit. The SDK can contain one or more APIs plus essential utilities. The API is just one part of an SDK. Think of the devkit as a larger “container” for an entire array of SDK tools and you’ll be correct.
Well, long story short – It is impossible to hide the Javascript source code, as it is downloaded into the client computer in cleartext. But there are still ways to make it difficult to decipher the code: Obfuscate the Javascript. Disable right-click on the pages. Disable view source shortcut keys.
@available
is a runtime availability check, not really usable for compile-time stuff in this situation.
In Objective-C, you can wrap the code part applied on iOS 15 SDK into another, macro condition:
#ifdef __IPHONE_15_0
if (@available(iOS 15.0, *)) {
...
} else {
#endif
// possible legacy branch code
#ifdef __IPHONE_15_0
}
#endif
__IPHONE_15_0
is defined starting with iOS 15 SDK, thus being omitted when building in Xcode 12/iOS 14 SDK. đź‘Ť
Another similar solution for Swift classes can be found here: https://stackoverflow.com/a/69583441/1195661:
#if swift(>=5.5) // Only run on Xcode version >= 13 (Swift 5.5 was shipped first with Xcode 13).
if #available(iOS 15.0, *) {
UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance
}
#endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With