Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27410] iOS: Module project is not compiling properly on 8.1.1.GA

GitHub Issuen/a
TypeStory
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2019-10-30T18:07:00.000+0000
Affected Version/sn/a
Fix Version/sRelease 8.3.0
ComponentsiOS
Labelsn/a
ReporterRakhi Mitro
AssigneeJan Vennemann
Created2019-09-19T11:38:37.000+0000
Updated2019-10-30T18:07:00.000+0000

Description

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)

Attachments

FileDateSize
build_sdk811ga_logs.txt2019-09-19T11:38:23.000+000064376

Comments

  1. Jan Vennemann 2019-09-26

    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:
       TITANIUM_SDK_VERSION = 8.1.1.GA
       TITANIUM_SDK = ~/Library/Application Support/Titanium/mobilesdk/osx/$(TITANIUM_SDK_VERSION)
       HEADER_SEARCH_PATHS = $(inherited) "$(TITANIUM_SDK)/iphone/include"
       FRAMEWORK_SEARCH_PATHS = $(inherited) "$(TITANIUM_SDK)/iphone/Frameworks"
       
    Also it is recommended since 8.0.0 to include classes from the TitaniumKit framework directly, if available from there.
       #import <TitaniumKit/TiApp.h>
       
  2. Jan Vennemann 2019-10-16

    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:
       [TRACE] [xcode-sim] In file included from /Users/jvennemann/Downloads/NdSyncClient2/ios/Classes/JpCoNdsoftNdSyncClinet2Module.m:12:
       [TRACE] [xcode-sim] In file included from /Users/jvennemann/Library/Application Support/Titanium/mobilesdk/osx/8.1.1.GA/iphone/include/TiApp.h:1:
       [TRACE] [xcode-sim] In file included from /Users/jvennemann/Library/Application Support/Titanium/mobilesdk/osx/8.1.1.GA/iphone/Frameworks/TitaniumKit.framework/Headers/TiApp.h:11:
       [TRACE] [xcode-sim] /Users/jvennemann/Library/Application Support/Titanium/mobilesdk/osx/8.1.1.GA/iphone/Frameworks/TitaniumKit.framework/Headers/KrollBridge.h:15:1: error: use of '@import' when modules are disabled
       [TRACE] [xcode-sim] @import Foundation;
       
    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
  3. Satyam Sekhri 2019-10-29

    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
  4. Christopher Williams 2019-10-30

    merged to master
  5. Satyam Sekhri 2019-10-30

    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

JSON Source