Reputation: 3824
I'm trying to NSLog
value of a NSString
which is references inside a @autoreleasepool
, but XCode complains of Format specifies type 'char *' but the argument has type 'NSString *__autoreleasing **'
anotherFunction {
NSString *myString = nil;
compute = [self checkForError:data myString:&myString];
}
- (NSDictionary *)checkForError:(NSData *)data myString:(NSString **)myString {
@autoreleasepool {
*myString = nil;
@try {
NSMutableString *myString1 = [[NSMutableString alloc] init];
// do something on myString1
*myString = myString1;
------> NSLog(@"mutableString is:%s", myString ); // Format specifies type 'char *' but the argument has type 'NSString *__autoreleasing **'
}
}
return myDictionary;
}
Upvotes: 0
Views: 67
Reputation: 162722
(I totally misread the question).
So, yeah-- use '%@' for object types. Pass *myString to NSLog() to convert an NSString ** to an NSString *.
Note that you should probably be using NSError
to encapsulate the errors and you should check to see if your pass by reference parameter is NULL before assigning to it.
See:
https://nshipster.com/nserror/
Upvotes: 1