简体   繁体   中英

ambiguous “use of unresolved identifier” error?

I'm getting this use of unresolved identifier error which is pretty ambiguous to me, it appears on the following line :

在此处输入图片说明

however the "LUTToNSDataConverter" Is initialized in the following file :

//
//  LUTToNSDataConverter.h
//  imglyKit
//
//  Created by Carsten Przyluczky on 29/01/15.
//  Copyright (c) 2015 9elements GmbH. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface LUTToNSDataConverter : NSObject

+ (nullable NSData *)colorCubeDataFromLUTNamed:(nonnull NSString *)name interpolatedWithIdentityLUTNamed:(nonnull NSString *)identityName withIntensity:(float)intensity cacheIdentityLUT:(BOOL)shouldCache;

/*
 This method reads an LUT image and converts it to a cube color space representation.
 The resulting data can be used to feed an CIColorCube filter, so that the transformation 
 realised by the LUT is applied with a core image standard filter 
 */
+ (nullable NSData *)colorCubeDataFromLUT:(nonnull NSString *)name;

@end

I may add, this variable became "unresolved" when I dragged the whole folder up from Pods project target up to my regular project target, so Xcode can recognize it. How do I resolve this?

You need to add a Bridging-header because you are using Objective-C classes:

  1. Add a header file to your project, named [MyProjectName]-Bridging-Header.h. This will be the single header file where you import any Objective-C code you want your Swift code to have access to.

  2. In your project build settings, find Swift Compiler – Code Generation, and next to Objective-C Bridging Header add the path to your bridging header file, from the project's root folder. So it could by MyProject/MyProject-Bridging-Header.h or simply MyProject-Bridging-Header.h if the file lives in the project root folder.

After that, you can add the imports to that file like that:

#import "YourHFile.h"

( source )

Compiler doesn't know LUTToNSDataConverter what is it? So please use like this

  1. First import this file in your Current View Controller

  2. And then call method on class, put () after class name like this LUTToNSDataConverter().

for ex

LUTToNSDataConverter(). colorCubeDataFromLUTNamed()// Pass your arguments here

Hope it helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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