Having an issue compiling a custom module for iOS

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Winterfresh92
:warning: Old Version Published before Godot 3 was released.

I’m trying to get my custom ad module to compile for iOS, but it’s having issues realizing that NSObject and NSString are data types. This is using the godot-2.1 branch. I’ve also been able to successfully compile and generate ads on Android.

I’ll link a repository to look at the code and config files, but from what I can tell based on all of the examples I’ve used, I feel they should work.

Repository

Here is the command I use to compile (note: the same occurs when targeting for debug or using specific architectures):

scons platform=iphone target=release

And the error log:

In file included from modules/adbuddiz/ios/src/godotadbuddiz.mm:5:
In file included from modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddiz.h:6:
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddizDelegate.h:34:29: error: cannot find protocol declaration for 'NSObject' [2]
@protocol AdBuddizDelegate <NSObject>
                         ^
In file included from modules/adbuddiz/ios/src/godotadbuddiz.mm:5:
In file included from modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddiz.h:7:
In file included from modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddizRewardedVideo.h:6:
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddizRewardedVideoDelegate.h:7:42: error: cannot find protocol declaration for 'NSObject' [2]
@protocol AdBuddizRewardedVideoDelegate <NSObject>
                                      ^
In file included from modules/adbuddiz/ios/src/godotadbuddiz.mm:5:
In file included from modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddiz.h:7:
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddizRewardedVideo.h:8:36:{8:1-8:33}: error: cannot find interface declaration for 'NSObject', superclass of 'AdBuddizRewardedVideo' [2]
@interface AdBuddizRewardedVideo : NSObject
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ^
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddizRewardedVideo.h:38:4: error: expected a type [4]
 - (BOOL)isReadyToShow;
^
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddizRewardedVideo.h:47:20: error: expected a type [4]
 - (void)setUserId:(NSString*)userId;
                ^
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddizRewardedVideo.h:70:4: error: expected a type [4]
 - (NSString *)nameForError:(AdBuddizError)error;
^
In file included from modules/adbuddiz/ios/src/godotadbuddiz.mm:5:
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddiz.h:15:23:{15:1-15:20}: error: cannot find interface declaration for 'NSObject', superclass of 'AdBuddiz' [2]
@interface AdBuddiz : NSObject
~~~~~~~~~~~~~~~~~~~   ^
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddiz.h:45:26: error: expected a type [4]
+ (void)setPublisherKey:(NSString *)publisherKey;
                      ^
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddiz.h:86:4: error: expected a type [4]
+ (BOOL)isReadyToShowAd;
^
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddiz.h:99:4: error: expected a type [4]
+ (BOOL)isReadyToShowAd:(NSString *)placement;
^
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddiz.h:99:26: error: expected a type [4]
+ (BOOL)isReadyToShowAd:(NSString *)placement;
                      ^
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddiz.h:118:17: error: expected a type [4]
+ (void)showAd:(NSString*)placement;
             ^
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddiz.h:141:4: error: expected a type [4]
+ (NSString *)nameForError:(AdBuddizError)error;
^
modules/adbuddiz/ios/src/godotadbuddiz.mm:19:35:{19:35-19:48}: error: no viable conversion from 'String' to 'id' [2]
     [AdBuddiz setPublisherKey:publisher_key];
                               ^~~~~~~~~~~~~
modules/adbuddiz/ios/lib/AdBuddiz.framework/Headers/AdBuddiz.h:45:37: note: passing argument to parameter 'publisherKey' here [2]
+ (void)setPublisherKey:(NSString *)publisherKey;
                                 ^
14 errors generated.
scons: *** [modules/adbuddiz/ios/src/godotadbuddiz.iphone.opt.arm64.o] Error 1
scons: building terminated because of errors.

If there is any other information I can provide for you please let me know, and thank you for any assistance!

:bust_in_silhouette: Reply From: Winterfresh92

In case anyone else has this problem, I was missing an import for Foundation/Foundation.h. I feel good about myself now. /s

Anyhoo, I’ll update the repository shortly with the correct imports.

do the repository works well right now?
cause im building a custom module for android and ios.
And i want to use ur repo for my reference. :frowning:
i was so confused.

Garalax | 2020-10-12 17:05