2016-11-17 55 views
0

我無法在CarbonCore框架中找到「FNSubscribe」方法的替代品。這個函數被用來觀察一個目錄中的任何改變,並在改變的情況下執行一個回調函數。FNS訂閱Cocoa中的替換

/* 
* FNSubscribe() 
* 
* Summary: 
* Subscribe to change notifications for the specified directory. 
* 
* Mac OS X threading: 
* Thread safe since version 10.1 
* 
* Parameters: 
*  
* directoryRef: 
*  Directory for which the caller wants notifications 
*  
* callback: 
*  Function to call back when a notification arrives 
*  
* refcon: 
*  User state carried with the subscription 
*  
* flags: 
*  Options for future use (specify kNilOptions, or one of the 
*  FNSubscriptionOptions) 
*  
* subscription: 
*  Subscription token for subsequent query or unsubscription 
* 
* Availability: 
* Mac OS X:   in version 10.1 and later in CoreServices.framework 
* CarbonLib:  not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later 
* Non-Carbon CFM: not available 
*/ 
extern OSStatus FNSubscribe(const FSRef *directoryRef, FNSubscriptionUPP callback, void *refcon, OptionBits flags, FNSubscriptionRef *subscription) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_8, __IPHONE_NA, __IPHONE_NA); 

如何使用Cocoa觀察目錄並最終運行回調函數?

回答