2013-01-11 39 views
0

尋找文檔: https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/Reference/Reference.htmlNSDataWritingFileProtectionComplete在OS X

我看到NSDataWritingFileProtectionComplete「可在OS X v10.8以及後來的」但是當我嘗試在我的代碼中使用它,我有一個編譯錯誤。檢查NSData標題我發現此功能僅適用於iOS:

NSDataWritingFileProtectionComplete NS_ENUM_AVAILABLE_IOS(4_0) 

我犯了錯誤或文檔不正確?

回答

2

看在MacOS的10.8 SDK中定義的枚舉,我看到:

typedef NS_OPTIONS(NSUInteger, NSDataWritingOptions) { 
    NSDataWritingAtomic = 1UL << 0, // Hint to use auxiliary file when saving; equivalent to atomically:YES 
    NSDataWritingWithoutOverwriting NS_ENUM_AVAILABLE(10_8, 6_0) = 1UL << 1, // Hint to return prevent overwriting an existing file. Cannot be combined with NSDataWritingAtomic. 

    NSDataWritingFileProtectionNone NS_ENUM_AVAILABLE_IOS(4_0)         = 0x10000000, 
    NSDataWritingFileProtectionComplete NS_ENUM_AVAILABLE_IOS(4_0)        = 0x20000000, 

NS_ENUM_AVAILABLE_IOS」 是擴展到

#define NS_ENUM_AVAILABLE_IOS(_ios) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_##_ios) 

宏的 「__MAC_NA」 位表示「不適用的「,這意味着文件目前是錯誤的。此功能僅適用於iOS。

你應該向Apple提交一份有關此文檔的bug。

+0

非常感謝! – user1204395