我在調用Swift項目的特定方法時遇到問題。這裏的ObjC方法簽名:Swift在調用中的額外參數
- (void)sd_setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletionBlock)completedBlock;
我不能把這個工作作爲XCode中不斷告訴我「額外的參數‘placeholderImage’呼叫」
self.lastLookImageView.setImageWithURL(url,
placeholderImage: nil,
options: SDWebImageRefreshCached,
completed: {
(image, error, cacheType) -> Void in
image = image.blurredImageWithRadius(30, iterations: 2, tintColor: UIColor.clearColor())
}
)
的XCode甚至不認識的方法當我Cmd +點擊它:「找不到符號」。
我懷疑它與塊有什麼關係,因爲我可以調用同一類的其他方法,這幾乎是相同的,但沒有完成塊。工作示例:
self.lastLookImageView.setImageWithURL(NSURL(string: self.lastLook!.image), placeholderImage: nil, options: SDWebImageRefreshCached)
爲背景的緣故:我用我混的OBJ-C和斯威夫特的項目稱爲SDWebImage(https://github.com/rs/SDWebImage)的組件。類已經導入我的橋接,Header.h
'forState'參數在哪裏,爲什麼有一個'完成的'參數捲到最後? – Abizern 2015-02-10 18:35:52
完成處理程序存在,它在H文件上(https://github.com/rs/SDWebImage/blob/master/SDWebImage/UIImageView%2BWebCache.h#L129) – FRAGA 2015-02-11 11:12:16
我編輯了問題以包含簽名I正在談論。對不起 – FRAGA 2015-02-11 11:14:00