Can't build MoPub on iOS 9.3: MoPub's MPErrorCode collides with enum in MediaPlayer



I’m getting this error when building MoPub 4.4.0 from source with Xcode 7.3 (iOS 9.3)

mopub-ios-sdk/MoPubSDK/Internal/Utility/MPError.h:21:3: Typedef redefinition with different types (‘enum MPErrorCode’ (aka ‘MPErrorCode’) vs ‘enum MPErrorCode’)

iOS 9.3 has a new enum in MediaPlayer/MPError.h:

typedef NS_ENUM(NSInteger, MPErrorCode) {
    MPErrorPermissionDenied,                        // the user has not granted permission for this request.
    MPErrorCloudServiceCapabilityMissing,           // the user has not enabled this capability
    MPErrorNetworkConnectionFailed,                 // the device could not connect to the network
    MPErrorNotFound,                                // the id could not be found in the current storefront
    MPErrorNotSupported,                            // the request is not supported (ex: trying to add items to a smart playlist)

…which conflicts with MoPub’s mopub-ios-sdk/MoPubSDK/Internal/Utility/MPError.h:

typedef enum {
    MPErrorUnknown = -1,
    MPErrorNoInventory = 0,
    MPErrorAdUnitWarmingUp = 1,
    MPErrorNetworkTimedOut = 4,
    MPErrorServerError = 8,
    MPErrorAdapterNotFound = 16,
    MPErrorAdapterInvalid = 17,
    MPErrorAdapterHasNoInventory = 18
} MPErrorCode;


I had the same problem and found your post while googling. Fortunately, MPErrorCode is only used in MPError.h/.m and MPErrorUnknown is not used anywhere as far as I can tell, so changing those to MOPErrorCode and MOPErrorUnknown worked for me.

Maybe Twitter will eventually need to change to MOP or another three letter prefix though.


I just ran into this today as well… I would hope that MoPub fixes this soon. I’m going to rename the enum type and all of the enums to start with “MOP” to get around this for now.

To be fair it looks like the MediaPlayer frameworks version of MPErrorCode was just introduced with iOS 9.3


Hi all,

Thanks so much for reporting this to us. I’m working on escalating to our product team for further research. I unfortunately cannot provide a specific timeline for a potential resolution, but please keep an eye on our Github page for future SDK updates. Apologies for the late response to this post.

You can always reach us at if you have any questions or issues. We’ll do our best to respond back as soon as we can!