ios programming - Data argument not used by format string

后端 未结 2 1633
刺人心
刺人心 2021-01-05 03:52

I get a Data argument not used by format string error when I run the following code:

- (void)pickerView:(UIPickerView *)thePickerView didSelectR         


        
2条回答
  •  离开以前
    2021-01-05 04:47

    NSLog(@"NSString = ", colour);    
    NSLog(@"NSUserDefaults =", [defaults objectForKey:@"colour"]);
    

    Is problematic

    Should be

    NSLog(@"NSString = %@", colour);
    NSLog(@"NSUserDefaults = %@", [defaults objectForKey:@"colour"]);
    

    The format specifier in this case is the %@ which is used to print an object. To print numbers you'd use something like %d. See complete documentation here.

提交回复
热议问题