2013-05-06 41 views
1

我想創建一個包含TARGET_OS_IPHONE條件的源文件的庫的podspec。掉毛報告錯誤Podspec linting失敗TARGET_OS_IPHONE有條件

YapDatabase (1.2.1) 
    - ERROR | [OSX] [xcodebuild] 
YapDatabase/YapDatabase/Abstract/YapAbstractDatabaseConnection.m:78:8: 
error: property 'autoFlushMemoryLevel' not found on object of type 
'YapAbstractDatabaseConnection *' 
    - ERROR | [OSX] [xcodebuild] 
YapDatabase/YapDatabase/Abstract/YapAbstractDatabaseConnection.m:398:30: error: 
no visible @interface for 'YapAbstractDatabaseConnection' declares the selector 
'autoFlushMemoryLevel' 

這裏是podspec:

Pod::Spec.new do |s| 
    s.name   = "YapDatabase" 
    s.version  = "1.2.1" 
    s.summary  = "A key/value store built atop sqlite for iOS & Mac." 

    s.homepage  = "https://github.com/yaptv/YapDatabase" 



    s.license  = 'MIT' 



    s.author  = { "yaptv" => "[email protected]" } 

    s.source  = { :git => "https://github.com/yaptv/YapDatabase.git", :tag => "1.2.1" } 



    s.ios.deployment_target = '6.0' 
    s.osx.deployment_target = '10.75' 


    s.source_files = 'YapDatabase/**/*.{h,m}','Vendor/**/*.{h,m}' 
    s.exclude_files = 'YapDatabase/Testing' 


    s.public_header_files = 'YapDatabase/Key_Value/YapDatabase.h' 


    s.requires_arc = true 


end 

,這裏是源代碼行顯然會導致錯誤:

#if TARGET_OS_IPHONE 
/** 
* When a UIApplicationDidReceiveMemoryWarningNotification is received, 
* the code automatically invokes flushMemoryWithLevel and passes this set level. 
* 
* The default value is YapDatabaseConnectionFlushMemoryLevelMild. 
* 
* @see flushMemoryWithLevel: 
**/ 
@property (atomic, assign, readwrite) int autoFlushMemoryLevel; 
#endif 

我使用Cocoapods v.0.19.1,那麼爲什麼會拋出這個錯誤,我該如何解決它?

回答

0

它看起來像你在OS X上導入一個文件,試圖使用該屬性。具體爲YapDatabase/YapDatabase/Abstract/YapAbstractDatabaseConnection.m。由於此屬性未在OS X上聲明,因此無法找到它。這也解釋了錯誤:

no visible @interface for 'YapAbstractDatabaseConnection' declares the selector 'autoFlushMemoryLevel' 

在這也表明在錯誤的線路:

ERROR | [OSX] [xcodebuild] YapDatabase/YapDatabase/Abstract/YapAbstractDatabaseConnection.m:78:8: 
ERROR | [OSX] [xcodebuild] YapDatabase/YapDatabase/Abstract/YapAbstractDatabaseConnection.m:398:30 

要解決這個問題,你會想看看exclude_files您可以使用特定平臺的東西,如:

s.osx.exclude_files = 'path/to/files' 

雖然只是排除這個單個文件可能不起作用,因爲其他文件也可能需要這個。這真的取決於你的代碼是如何設置的。