我在 4 小时内变得疯狂,我真的需要帮助。这是代码:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
//check if strGroup has prefix and suffix #
BOOL result;
result = [strGroup hasPrefix: @"#"];
if (result)
{
result = [strGroup hasSuffix: @"#"];
if (result)
{
NSMutableString* string = [NSMutableString stringWithString: strGroup];
str = [strGroup substringWithRange: NSMakeRange (1, [string length]-2)];
strToHoldAllContact = [NSString stringWithFormat:@"%@",str];
}
}
NSLog(@"strToHoldAllContact=%@",strToHoldAllContact);
}
我得到了strToHoldAllContact
正确的价值。但是当我尝试strToHoldAllContact
从另一种方法访问时,我收到了错误:
[CFString respondsToSelector:]: message sent to deallocated instance 0x856f2a0