Integration fail for mopub-ios-sdk


In regards to the mopub-ios-SDK, I am on the Getting Started page. We had an older version of the mopub framework in our project, and now are looking to update to the newest version. We’re using Xcode version 8 and Objective C.

Documentation mentioned to remove old sdk so I moved the mopub framework files to the trash.

Step 1. Download the MoPub SDK

Step 2. Add the SDK to your Xcode project.

During step 2, I set the mopub SDK files flag to “-fobjc-arc” as the MoPub documentation said since we are using MRC. Then many issues appeared regarding syntax & weak/strongSelf.


A workaround on this forum states to:

replace: __weak typeof(self) weakSelf = self; with: __typeof__(self) __weak weakSelf = self;
replace: typeof(self) strongSelf = weakSelf; with: __typeof__(self) strongSelf = weakSelf;

After doing so, I found another error regarding syntax & strongSelf as indicated in the screenshot below:


I also changed line 62 to __typeof__(self) __strong strongSelf = weakSelf; using the issue on this site for reference.
However, it caused me to change similar lines in several more source code files.

Upon making those workaround changes, I got different errors: Multiple methods named 'addObject' found with mismatched result, parameter type or attributes. I saw that casting a type could be a possible solution.

I changed line 52 to
[(NSMutableArray *) parentElement[elementName] addObject:currentElement] ;.

In MPVASTModel.m

I changed line 228 to
} else if ([modelMapValue isKindOfClass:[NSArray class]] && [(NSArray *) modelMapValue count] == 2) {

I changed line 258 to
if (value && [value isKindOfClass:[NSArray class]] && [(NSArray *)value count] > 0) {

After changing all that, there seems to be no errors when I make a build.

Can someone from mopub confirm with me that all the changes I made wont cause any problems? All these manual changes in your source files seems kinda hacky.


Hi @lowang,

Thank you for reaching out to us.

Yes, I’m able to recreate the issue, currently we are reviewing the steps suggested, I’ll keep you posted once all the steps are validated by our team.



Hi @lowang-

We were able to fix this issue by following the steps mentioned below-

Change Build Setting to disable ARC
Change Build Setting to enable weak references in MRC
Selected all of MoPub SDK files in the Build Phases > Compile Sources (excluding files that are in MoPubSampleApp/*) and tagged them with the -fobjc-arc flag.
Clean, build, and run

This should resolve the problem. Please let us know if you still notice the issues.