Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reference to enum is ambiguous objective-c

I defined a NS_ENUM below in another file:

typedef NS_ENUM (NSUInteger, LinkPlatformType){
    LinkPlatformTypeEmail = 1,
    LinkPlatformTypeFacebook,
    LinkPlatformTypeGoogle
};

When I try to do a switch case:

- (void)linkWithType:(LinkPlatformType)linkType {
    switch (linkType) {
        case LinkPlatformTypeGoogle:
            break;
        case LinkPlatformTypeFacebook:
            break;
        default:
            break;
    }
}

I am getting a build error: Reference to LinkPlatformTypeGoogle is ambiguous. Reference to LinkPlatformTypeFacebook is ambiguous.

Updates:

The file defines.h which i defined the enum is in for example Target 1, And there is a Class StoreClass which import this defines.h file. And the StoreClass.m Target Membership I have set as multiple targets: Target 1 and Target 2. So after I do this, the Reference to LinkPlatformTypeFacebook is ambiguous appeared. Will this be the reason?

like image 511
yong ho Avatar asked May 27 '15 08:05

yong ho


1 Answers

Changing the import from

#import "SwipeView.h"

to

@import SwipeView;

worked for me

like image 95
Fraser Avatar answered Sep 20 '22 04:09

Fraser