This is a migrated thread and some comments may be shown as answers.

AppBuilder build error with Cordova Plugin: use of '@import' when modules are disabled

2 Answers 152 Views
Apache Cordova
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
MoriartyX64
Top achievements
Rank 1
MoriartyX64 asked on 01 May 2015, 09:36 AM

I have a custom iOS plugin that is built with modules enabled, in order to use the native Photos Framework introduced in iOS 8.x:
https://developer.apple.com/library/ios/documentation/Photos/Reference/Photos_Framework/

This works just fine in Xcode. But it does require a specific build setting in Xcode to Enable Modules (C and Objective-C). See also:
http://stackoverflow.com/a/25883210/1039247

Importing this custom plugin in AppBuilder (VisualStudio extension) also works just fine. The problem is, upon building it with AppBuilder, for example when trying to deploy it to a locally attached device, we get the following error:

Error: [xcode-build] Compile /tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/SOSPicker.m: In file included from /tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/SOSPicker.m:12:
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:9:1: error: use of '@import' when modules are disabled
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:10:1: error: use of '@import' when modules are disabled
In file included from /tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/SOSPicker.m:12:
In file included from /tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:12:
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMFetchItem.h:11:1: error: use of '@import' when modules are disabled
In file included from /tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/SOSPicker.m:12:
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:84:22: error: expected a type
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:85:24: error: expected a type
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:138:83: error: expected a type
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:148:85: error: expected a type
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:164:85: error: expected a type
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:173:82: error: expected a type
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:184:87: error: expected a type
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:193:84: error: expected a type
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:209:88: error: expected a type
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:218:85: error: expected a type
/tmp/builds/WVBfZ76xiIaDb97mpk/app/Cordova370/Plugins/com.acme.sandbox/GMsandboxController.h:228:87: error: expected a type
Error: 'Build failed with error code 2'

 

So, the main error seems to be: **error: use of '@import' when modules are disabled**

In short, is there any way to set AppBuilder to configure AppBuilder to build with this specific setting ('Enable Modules') for iOS upon a cloud build? If not, are there any workarounds regarding this?

Thanks in advance.

 

 

2 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 06 May 2015, 10:45 AM
Hi MoriartyX64,

As said in your support ticket on the same matter, at this stage it is not possible to enable the modules in XCode for AppBuilder cloud builds. Still, this is something that we will further investigate in order to decide if we can include them as an option.

Meanwhile, I can only suggest that you refactor the custom plugin's binaries to support the old import method in Objective C. For that purpose, you will need to change the @import to #import. For example:
@import UIKit
@import Foundation
 
// to
 
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

I hope this helps. If there are any further issues however, you can send us the custom Cordova plugin to us, so we can investigate it on our side. If you decide to do this, please use the already opened by you support ticket as it is strictly confidential.

Regards,
Kaloyan
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
MoriartyX64
Top achievements
Rank 1
answered on 07 May 2015, 11:26 AM

Thanks for the suggestion. The suggested refactoring seemed to do the trick. I'm looking forward to enabling modules as an option in the near future.

 For other people who come across issues with custom Cordova plugins and not being able to build: it did require a RELEASE build and kept on failing with unclear error messages in a DEBUG build. There was no specific error message (e.g. a log trace of over 1200 lines, but no clear "errors" in it other than 500 Internet Server Error + a lot of notices regarding `com.telerik.afnetworking/*`) so setting the build to RELEASE was a shot in the dark that worked out fine in the end. 

 

 

 

 

Tags
Apache Cordova
Asked by
MoriartyX64
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
MoriartyX64
Top achievements
Rank 1
Share this question
or