2

关于新的MoPub iOS SDK 3.0.0及其入门文档:

  1. 下载 MoPub SDK
  2. 将 SDK 添加到您的 Xcode 项目中。
  3. ...

在第 2 步中,由于 Unity 3D 生成 MRC Xcode 项目并且 MoPub 文档说:

If your application uses Manual Reference Counting (MRC) you must tell the compiler to build the MoPub iOS SDK source files with ARC.

所有 SDK 文件的编译器标志都设置为-fobjc-arc. 然后又出现了两个新问题:

  1. "Cannot use '@try' with Objective-C exceptions disabled" Error这是通过在项目的构建设置中启用 Objective-C 异常来修复的;和
  2. '__weak' only applies to Objective-C object or block pointer types;来自文件MPStreamAdPlacer.m(见附件截图)。

MoPubMRCIntegrationError1.jpg MoPubMRCIntegrationError2.jpg

由于文档未涵盖上述问题,我该如何修复这些最后的编译错误?

注意:适用于MoPub iOS SDK 2.4.0

4

2 回答 2

3

问题:https ://github.com/mopub/mopub-ios-sdk/issues/82

khchen428 说:

感谢您报告此问题!我们很快就会解决。同时,这里有一个解决方法:MoPubSDK/Native Ads/MPStreamAdPlacer.m从第 156 行开始:

将:替换 __weak typeof(self) weakSelf = self; 为: __typeof__(self) __weak weakSelf = self;

并将:替换 typeof(self) strongSelf = weakSelf; 为: __typeof__(self) strongSelf = weakSelf;

于 2014-10-03T19:18:16.173 回答
1

我删除了行:

__weak typeof(self) _weakSelf = self;

typeof(self) strongSelf = _weakSelf;

并将所有引用strongSelf替换为self

这个对我有用

于 2014-10-03T09:20:03.473 回答