简体   繁体   English

对枚举的引用是模糊的目标-c

[英]Reference to enum is ambiguous objective-c

I defined a NS_ENUM below in another file: 我在另一个文件中定义了下面的NS_ENUM:

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 LinkPlatformTypeGoogle is ambiguous Reference to LinkPlatformTypeFacebook 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. 我定义了枚举的文件定义为例如目标1,并且有一个类StoreClass导入这个define.h文件。 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. 我将StoreClass.m目标成员资格设置为多个目标:目标1和目标2.因此,在执行此操作后, Reference to LinkPlatformTypeFacebook is ambiguousReference to LinkPlatformTypeFacebook is ambiguous出现了Reference to LinkPlatformTypeFacebook is ambiguous Will this be the reason? 这是原因吗?

Changing the import from 更改导入

#import "SwipeView.h"

to

@import SwipeView;

worked for me 为我工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM