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.
/MPAdDestinationDisplayAgent.m
A workaround on this forum states to:
replace: __weak typeof(self) weakSelf = self; with: __typeof__(self) __weak weakSelf = self;
AND
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:
/MPNativeAdRendererImageHandler.m
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.
/MPXMLParser.m
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.