2015-12-03 59 views
0

我正在使用pinterest SDK將圖像發佈到pinterest。但我無法弄清楚我需要傳遞的參數「withSuccess」和「andFailure」在我的應用程序中調用以下方法的數據?iOS Pinterest API

-(void)createPinWithImageURL:(NSURL *)imageURL link:(NSURL *)link onBoard:(NSString *)boardId description:(NSString *)pinDescription withSuccess:(PDKClientSuccess)successBlock andFailure:(PDKClientFailure)failureBlock; 

回答

0

這些都是回調函數 - 您編寫的函數,當帖子成功或失敗時會被調用。 例如,從Pinterest's documentation,這裏是你會怎麼稱呼類似的方法成功和失敗的回調:

[[PDKClient sharedInstance] getPath:@"me/" 
        parameters:nil 
        withSuccess:^(PDKResponseObject *responseObject) { 
         // success actions - the code you write here will 
         // be called if the call succeeds. 
         // responseObject will contain information about 
         // the result of the call. 
        } andFailure:^(NSError *error) { 
         // failure actions - the code you write here will 
         // be called if the call fails. error will give 
         // you information about why the call failed. 
        }]; 

的回調是一個類型的對象稱爲目標C. Apple's documentation「塊」是一個合理的地方開始瞭解塊,但有很多其他教程。

+1

非常感謝! – Franky