出于某种原因,当我执行[string isEqualToString:string
] 时,我得到一个“NO”。
在图片中,“项目”被声明为@property NSString *item;
我最初将其声明为平原NSString *item
,但它仍然没有工作。
任何想法我做错了什么?
这是代码,我试图做一个屏幕截图来显示调试器输出,但没有足够的声誉。
- (IBAction)playCourseSelection:(id)sender
{
// Get File Directory
NSArray *arrayPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docDirectory = [arrayPaths objectAtIndex:0];
NSString *filePath = [docDirectory stringByAppendingString:@"/playCourse.txt"];
// Write String for course
NSString *writeString = item;
BOOL test;
test = [item isEqualToString:@"Add Course..."];
if (test)
{
writeString = @"";
};
[writeString writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:nil];
// Close the file
}
self EditCourseViewController * 0x0848c770
test BOOL '\0'
writeString NSString * 0x07676b80
item NSString * 0x07676b80