1

我正在将 UnityAds 用于 iOS/Android 游戏,并且在为 iOS 生成 Xcode 项目时,出现以下与 UnityAdsWrapper.mm 相关的编译器错误,UnityAdsWrapper.mm 是由 Unity 生成的文件

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:105:15: error: no known class method for selector 'sharedInstance'

                    [[UnityAds sharedInstance] setUnityVersion: UnityAdsCreateNSString(unityVersion)];

                               ^~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:105:31: error: no known instance method for selector 'setUnityVersion:'

                    [[UnityAds sharedInstance] setUnityVersion: UnityAdsCreateNSString(unityVersion)];

                                               ^~~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:126:18: error: no known class method for selector 'sharedInstance'

            if ([[UnityAds sharedInstance] canShowZone:zoneId])

                           ^~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:126:34: error: no known instance method for selector 'canShowZone:'

            if ([[UnityAds sharedInstance] canShowZone:zoneId])

                                           ^~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:130:16: error: no known class method for selector 'sharedInstance'

                            [[UnityAds sharedInstance] setZone:zoneId withRewardItem:rewardItemKey];

                                       ^~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:130:32: error: no known instance method for selector 'setZone:withRewardItem:'

                            [[UnityAds sharedInstance] setZone:zoneId withRewardItem:rewardItemKey];

                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:136:22: error: no known class method for selector 'sharedInstance'

                           [[UnityAds sharedInstance] setZone:zoneId];

                                      ^~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:136:38: error: no known instance method for selector 'setZone:'

                           [[UnityAds sharedInstance] setZone:zoneId];

                                                      ^~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:139:22: error: no known class method for selector 'sharedInstance'

                    return [[UnityAds sharedInstance] show:optionsDictionary];

                                      ^~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:139:43: error: cannot initialize a parameter of type 'UIViewController * _Nonnull' with an lvalue of type 'NSMutableDictionary *__strong'

                    return [[UnityAds sharedInstance] show:optionsDictionary];

                                                           ^~~~~~~~~~~~~~~~~

In file included from /ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:6:

In file included from /ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.h:10:

/ProjectDir/Builds/Build/UnityAds.framework/Headers/UnityAds.h:175:34: note: passing argument to parameter 'viewController' here

+ (void)show:(UIViewController *)viewController;

                             ^

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:146:21: error: no known class method for selector 'sharedInstance'

            return [[UnityAds sharedInstance] canShowZone:UnityAdsCreateNSString(rawZoneId)];

                              ^~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:146:37: error: no known instance method for selector 'canShowZone:'

            return [[UnityAds sharedInstance] canShowZone:UnityAdsCreateNSString(rawZoneId)];

                                              ^~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:151:14: error: no known class method for selector 'sharedInstance'

            [[UnityAds sharedInstance] setDebugMode:debugMode];

                       ^~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:156:14: error: no known class method for selector 'sharedInstance'

            [[UnityAds sharedInstance] setCampaignDataURL:UnityAdsCreateNSString(url)];

                       ^~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:156:30: error: no known instance method for selector 'setCampaignDataURL:'

            [[UnityAds sharedInstance] setCampaignDataURL:UnityAdsCreateNSString(url)];

                                       ^~~~~~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:45:14: error: no known class method for selector 'sharedInstance'

            [[UnityAds sharedInstance] setDelegate:self];

                       ^~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:46:14: error: no known class method for selector 'sharedInstance'

            [[UnityAds sharedInstance] setDebugMode:debugMode];

                       ^~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:47:14: error: no known class method for selector 'sharedInstance'

            [[UnityAds sharedInstance] setTestMode:testMode];

                       ^~~~~~~~~~~~~~

/ProjectDir/Builds/Build/Classes/UnityAds/UnityAdsUnityWrapper.mm:47:30: error: no known instance method for selector 'setTestMode:'

            [[UnityAds sharedInstance] setTestMode:testMode];

                                       ^~~~~~~~~~~

fatal error: too many errors emitted, stopping now [-ferror-limit=]

20 errors generated.

有人对此有解决方法或解决方法吗?

4

1 回答 1

1

看起来您使用的是旧版本的 UnityAds - 尝试使用 Asset Store 中的最新版本。

于 2016-11-24T09:41:26.187 回答