我做了發件人類和發送對象:如何檢查函數的參數是否爲零?
Sender *sender = [[Sender alloc] init];
於是,我寫了測試:
// should success
[sender upload:[UIImage imageNamed:@"test2.jpg"] withName:@"test2.jpg"];
// should fail
[sender upload:nil withName:@"test2.jpg"];
於是,我寫了無校驗碼:
- (void)upload:(UIImage *)image withName:(NSString *)name
{
if ([image isEqual:nil]) {
...
}
...
}
但無檢查被忽略。 如何檢查圖像參數是否爲零? 謝謝你的好意。