[TIMOB-28522] iOS: Cannot exclude iOS only modules from universal build
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Hans Knöchel |
Assignee | Unknown |
Created | 2021-08-13T14:45:55.000+0000 |
Updated | 2021-08-17T09:35:48.000+0000 |
Description
We have a native SDK which is iOS only, so we want to exclude it from the module build (which is easy to do in Xcode by unchecking it in the Build Phases tab and wrapping the iOS-only code with
#if !TARGET_OS_MACCATALYST
statements. But unfortunately, the Titanium module CLI (_buildModule.js) still thinks we use it because it only checks if the file exists, not the Xcode setting of the file.
An alternative would be to mark the module iOS only in the tiapp.xml by having something like <module platform="ios" exclude="mac_catalyst">...</module>
or platform="ios"
vs platform="ios_catalyst"
.
Without one of the solution, the Mac support is not finished I think. An example of how the files are marked in the .pbxproj file is attached. The problematic module source is attached as well. Compile it and you will notice the warning:
[WARN] The module is using frameworks (BytedanceOpenPlatformSDK.framework,SCSDKCoreKit.framework,SCSDKCreativeKit.framework,TikTokOpenSDK.framework) that do not support simulator arm64. Excluding simulator arm64. The app using this module may fail if you're on an arm64 Apple Silicon device.
Attachments
File | Date | Size |
---|---|---|
Bildschirmfoto 2021-08-13 um 16.46.27.png | 2021-08-13T14:47:10.000+0000 | 337493 |
PR (to be verified): https://github.com/appcelerator/titanium_mobile/pull/13022 In theory, because we explicitely make the frameworks only available on iOS (in the .xcodeproj) + have guards to only import the frameworks for iOS, it should be okay. Of course, the modules are still not compatible with macOS then, but the app can simply exclude those features until the libraries are ready.
[~hknoechel] I think maybe doing this via excluding a module in the tiapp might be better? It means that existing modules could be ignored without requiring they be recompiled. I had filed TIMOB-28245 to allow this, and I think doing it using the existing
--target
options would be best rather than introducing a new syntaxYep, probably! Also, my fix does not work because the build still tries to evaluate them at a later build stage. But the
--target
alone will not help because even the iOS Simulator does not run on an Apple Silicon device (thats the biggest issue right now).Using TIMOB-28525, this will be less critical and only relevant for macOS apps. But still, it would definitely improve the macOS adoption :-)