Henry F
Henry F

Reputation: 4980

Interpreting specific compiler warnings

I'm receiving three warnings for the code below. The warnings are:

1: "Receiver type 'const char *' is not 'id' or interface pointer, consider casting it to 'id'"
2: "Instance method '-alloc' not found (return type defaults to 'id')"
3: "Instance method '-hideBanner:' not found (return type defaults to 'id')"

Here is my code:

- (void)applicationWillEnterForeground:(UIApplication *)application
{

    MoPubManager *obj = [["MoPubManager.h" alloc] init];

    if( obj.adView ) {
        [self hideBanner:YES];
    }
    [obj.adView refreshAd];

}

What do these mean?

Upvotes: 0

Views: 488

Answers (4)

unexpectedvalue
unexpectedvalue

Reputation: 6139

MoPubManager *obj = [["MoPubManager.h" alloc] init];

Surely you meant:

MoPubManager *obj = [[MoPubManager alloc] init];

Upvotes: 1

Demz
Demz

Reputation: 1058

try

MoPubManager *obj = [[MoPubManager alloc] init];

"MoPubManager.h" is the header file, not the class name

Upvotes: 1

jonmorgan
jonmorgan

Reputation: 2610

"MoPubManager.h" is the name of a header file, not the class that it represents. You probably want to use [[MoPubManager alloc] init].

Upvotes: 2

Alladinian
Alladinian

Reputation: 35646

You are passing a cstring instead of the class. Try this:

MoPubManager *obj = [[MoPubManager alloc] init];

Upvotes: 2

Related Questions