Hex in a stringWithFormat BAD ACCESS

后端 未结 2 1653
渐次进展
渐次进展 2021-01-27 15:04

Here is a part of my code:

I have a string which is formed by a stringWithFormat like this:

NSString * DestChoice = [NSString stringWithFormat:@\"%@\", D         


        
相关标签:
2条回答
  • 2021-01-27 16:01
    NSString * DestChoice = [NSString stringWithFormat:stringWithFormat:@"%@%@", Dest1String];
    

    You are indicating that you want to format two objects with %@%@, but you are only supplying a single object (Dest1String).

    0 讨论(0)
  • 2021-01-27 16:10

    The only problem I am seeing with your code is

    NSString * DestChoice = [NSString stringWithFormat:stringWithFormat:@"%@", Dest1String];
    

    Instead, you could use

    NSString * DestChoice = [NSString stringWithString:@"%@", Dest1String];
    

    Other than that, there is no problem. I am getting correct result.

    0 讨论(0)
提交回复
热议问题