2015-08-25 92 views
0

我得到這個使用未解決的標識符錯誤的,這是相當不明確的對我來說,它出現在以下行:含糊不清的「使用未解決的標識符」錯誤?

enter image description here

但是「LUTToNSDataConverter」在以下文件中被初始化:

// 
// 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 

我可以添加,當我將整個文件夾從Pods項目目標拖到我的常規項目目標時,這個變量就變成了「無法解析」,所以Xcode可以識別它。我該如何解決這個問題?

回答

1

編譯器不知道LUTToNSDataConverter是什麼呢?所以,請使用這樣

  1. 首先導入該文件在當前視圖控制器

  2. 然後調用方法的類,把()類名後這樣 LUTToNSDataConverter()。

爲前

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

希望它可以幫助你。

1

您需要添加一個橋接頭,因爲你使用的Objective-C類:

  1. 添加一個頭文件到您的項目,名爲[MyProjectName] -Bridging-Header.h。這將是單個頭文件,您可以在其中導入希望Swift代碼訪問的任何Objective-C代碼。

  2. 在您的項目構建設置中,找到Swift Compiler - Code Generation,然後在Objective-C Bridging Header旁邊添加從項目的根文件夾到橋接頭文件的路徑。所以它可以通過MyProject/MyProject-Bridging-Header.h或簡單地MyProject-Bridging-Header.h如果文件居住在項目根文件夾。

之後,你就可以進口增加一樣,該文件:

#import "YourHFile.h" 

source

相關問題