0
XCode給我一個警告,說我找不到原因。XCode警告:參數3丟棄指針目標類型的限定符
@interface SFHFKeychainUtils : NSObject {
}
+ (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error;
@end
在另一類我稱之爲storeUsername:andPassword:forServiceName:updateExisting:錯誤:,看到:
- (void)armazenarLogin:(NSString *)login withPassword:(NSString *)password {
if (login != nil && password != nil) {
NSError *error = nil;
[SFHFKeychainUtils storeUsername:login andPassword:password forServiceName:kKeychainServiceName updateExisting:YES error:&error]; // warning here
}
}
這是警告:
Passing argument 3 of 'storeUsername:andPassword:forServiceName:updateExisting:error:' discards qualifiers from pointer target
但我傳遞指向NSError的指針。我如何解決此警告?
謝謝。你是對的kKeychainServiceName被聲明爲const。 – 2010-07-22 20:54:59