One user is facing error compiling a module. He is using 8.1.1.GA, Xcode 10.3, macOS Mojave 10.14.6. He is unable to build module project with TiApp.h using SDK8.1.1.GA ? His purpose is to use NSURLSessionDelegate, which requires importing TiApp.h according to the following [reference](
https://wiki.appcelerator.org/display/guides2/iOS+Modules+-+Use+Native+UI+Application+Delegates+in+Hyperloop+and+Native+Modules).
Sample module: Click [here|
https://drive.google.com/open?id=1jbVe3r4Rm1__Eu73gDdBiT0zBRuMgI9W]
*Test Steps:*
Steps from the user:
1. Create new mobile module project [jp.co.ndsoft.NdSyncClinet2] using SDK8.1.1.GA, target iOS.
2. Add code follows into ios/Classes/JpCoNdsoftNdSyncClinet2Module.m
3. Package iOS Module
*Add code at step2*
--- a/ios/Classes/JpCoNdsoftNdSyncClinet2Module.m
+++ b/ios/Classes/JpCoNdsoftNdSyncClinet2Module.m
@@ -9,6 +9,7 @@
#import "TiBase.h"
#import "TiHost.h"
#import "TiUtils.h"
+#import "TiApp.h"
@implementation JpCoNdsoftNdSyncClinet2Module
@@ -29,6 +30,12 @@
#pragma mark Lifecycle
+-(void)_configure
+{
+ [super _configure];
+ [[TiApp app] registerApplicationDelegate:self];
+}
+
- (void)startup
Note: We also tried to compile module shared by the client and receive same error as him.
[ERROR] [xcode-sim] ** BUILD FAILED **
[ERROR] [xcode-sim] The following build commands failed:
[ERROR] [xcode-sim] CompileC build/NdSyncClient2.build/Release-iphonesimulator/NdSyncClient2.build/Objects-normal/x86_64/JpCoNdsoftNdSyncClinet2Module.o Classes/JpCoNdsoftNdSyncClinet2Module.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
[ERROR] [xcode-sim] CompileC build/NdSyncClient2.build/Release-iphonesimulator/NdSyncClient2.build/Objects-normal/i386/JpCoNdsoftNdSyncClinet2Module.o Classes/JpCoNdsoftNdSyncClinet2Module.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
[ERROR] [xcode-sim] (2 failures)
If this is an existing module it is probably due to an outdated module configuration. Please take a look at our current [titanium.xcconfig](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/templates/module/objc/template/ios/titanium.xcconfig.ejs) template and update it accordingly. For example, with SDK 8.1.1.GA it should look something like this:
Also it is recommended since 8.0.0 to include classes from the
TitaniumKit
framework directly, if available from there.Alright, i took another look and this seems to be an issue with our module template. The error gives a very good hint at what is wrong:
So all they need to do is enable modules. This can be done easily by selecting the project in Xcode and then under "Build Settings" search for "Enable Modules (C and Objective-C)" and set it to "Yes". PR to update our template with recent clang settings: https://github.com/appcelerator/titanium_mobile/pull/11283
FR Passed. The clang setting to Enable Modules (C and Objective-C) is set to Yes by default. The module builds successfully. Waiting for Jenkins build to pass before merge
merged to master
Verified on: Mac OS: 10.14.5 SDK: 8.3.0.v20191030085531 Appc CLI: 7.1.1 JDK: 1.8.0_162 Node: 10.5.0 Studio: 5.1.4.201909061933 Xcode: 11.1