UnityAds 生成 iOS 项目错误
UnityAds generated iOS project error
我在 iOS/Android 游戏中使用 UnityAds,在为 iOS 生成 Xcode 项目时,我收到以下与 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.
有人对此有解决方法或修复方法吗?
看来您使用的是旧版本的 UnityAds - 试试 latest from the Asset Store。
我在 iOS/Android 游戏中使用 UnityAds,在为 iOS 生成 Xcode 项目时,我收到以下与 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.
有人对此有解决方法或修复方法吗?
看来您使用的是旧版本的 UnityAds - 试试 latest from the Asset Store。