當你擁有的是代理對象時,有什麼方法可以測試選擇器/方法嗎?如何測試Objective-C中代理對象的選擇器?
/* Proxy which may forward
* the method to some other object */
id proxy = [UINavigationBar appearance];
/* This condition returns FALSE
* despite the fact that the method would have otherwise been
* successfully executed at its destination */
if([proxy respondsToSelector:@selector(setBarTintColor:)]){
[proxy setBarTintColor:color];
}
@maddy這就是爲什麼我試圖找到一種方法來測試方法調用是否會在調用之前成功 - 而不是基於操作系統版本的邏輯.. – sean