- Home /
Use of @import when modules are disabled
hello user, I am new to unity and I am building my first project in iOS. There is a googleadmob plugins in my project. When I build the project in unity the project successfully build there is no problem. But in Xcode it gives me an error in GADUObjectCache.h that use of @import when modules are disabled I tried everything on google but nothing works.. Need help plz
Answer by Bhargav5530 · Jun 02, 2015 at 05:01 AM
I found answer myselft just
In Xcode set Enable Modules (C and Objective-C) to Yes in Build Settings.
Hi there, Im using Xcode 6.3 on iOS 8.3, but I CANT FIND that option, it seams now Xcode enable modules automatically. But still, doesnt work. One workaround I found is that I have to manually change each @import with #import, but I have to specify which file, for example: ins$$anonymous$$d of
@import Google$$anonymous$$obileAds;
#import <Google$$anonymous$$obileAds/Google$$anonymous$$obileAds.h>
And I could get rid of many errors, but I dont know how to change:
@import Foundation;
Any suggestions?, Regards
I'm having this same problem! There is no modules section. When I switch to the build settings for Unity iPhone Test, the module setting is there, but it's not in the main Unity Iphone Settings. Are you just building in Unity iPhone test? I would really love to get this working!
Answer by Altered · Jun 18, 2015 at 11:04 PM
I figured it out! In Xcode right under where you click "Build Settings" it says "All" and "Basic". Mine had basic selected, and even when you search from "modules", nothing shows up! But when I clicked "All" instead, I could see the modules setting.
You are a beautiful genius -- thank you so much. I was trying to figure this out for days and this solved my problem. Fantastic!!
Thank you so much, you just saved a lot of my time. I was trying to find it from couple of days.
Answer by lexi89puzzle · May 08, 2017 at 12:54 PM
To resolve this in Unity Cloud build, use the Xcode Manipulation API to set modules to "YES". Details in this post: https://forum.unity3d.com/threads/ios-cloud-build-error-use-of-import-when-modules-are-disabled.330706/
The key line is: proj.AddBuildProperty(target, "CLANG_ENABLE_MODULES", "YES");