shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
12/31/12 08:48 PM (13 years ago)

Use of undeclared identifier error

I'm getting 2 errors in Xcode Version 4.2 on an app that previously worked fine. It fails to build, but I can see the app in the simulator if I select Perform Action>Run Without Building, and it looks and runs good. Any ideas on what is causing this or how to correct? http://postimage.org/image/svtxj1ptv/
 
theMonster
Code is Art
Profile
Posts: 435
Reg: Oct 18, 2011
US
8,050
like
12/31/12 09:56 PM (13 years ago)
I'm thinking if you remove that '&' in the first error it should go away but I'm not sure it that will work. Any way you can show more code? (the entire method to be specific)
 
shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
like
01/01/13 11:30 AM (13 years ago)
Removing the '&' didn't change it. Build Failed, shows !Semantic Issue BT_Core>BT_fileManager.m>+markFileAsDoNotBackup: /* The purpose of this method is to mark a file with a flag to tell iOS not to backup the file to iCloud. */ BOOL ret = FALSE; if(fileName != nil && [fileName length] > 1){ NSFileManager *fileManager = [NSFileManager defaultManager]; BOOL success = [fileManager fileExistsAtPath:[self getFilePath:fileName]]; if(success){ //get URL to this file.... NSURL *fileURL = [NSURL fileURLWithPath:[self getFilePath:fileName]]; const char* filePath = [[fileURL path] fileSystemRepresentation]; const char* attrName = "com.apple.MobileBackup"; if (&NSURLIsExcludedFromBackupKey == nil) { // iOS 5.0.1 and lower u_int8_t attrValue = 1; ret = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0); ret = TRUE; //[BT_debugger showIt:self:[NSString stringWithFormat:@"markFileAsDoNotBackup: SUCCESS: %i", result]]; } else { // get rid of extended attribute if it exists already... int result = getxattr(filePath, attrName, NULL, sizeof(u_int8_t), 0, 0); if (result != -1) { int removeResult = removexattr(filePath, attrName, 0); if (removeResult == 0) { NSLog(@"Removed extended attribute on file %@", fileURL); } } NSError *error = nil; BOOL success = [fileURL setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:nil]; if(!success){ [BT_debugger showIt:self:[NSString stringWithFormat:@"markFileAsDoNotBackup: ERROR excluding: %@ from backup: %@", [fileURL lastPathComponent], error]]; ret = FALSE; }else{ ret = TRUE; } } /* NSError *error = nil; BOOL success = [fileURL setResourceValue: [NSNumber numberWithBool:YES] forKey: NSURLIsExcludedFromBackupKey error: &error]; if(!success){ [BT_debugger showIt:self:[NSString stringWithFormat:@"markFileAsDoNotBackup: ERROR excluding: %@ from backup: %@", [fileURL lastPathComponent], error]]; } */ }else{ [BT_debugger showIt:self:[NSString stringWithFormat:@"markFileAsDoNotBackup ERROR, file does not exist: %@", fileName]]; } } //return... return ret; }
 
shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
like
01/01/13 12:17 PM (13 years ago)
An older file builds ok, but any new source code shows this error.
 
runr140
I hate code!
Profile
Posts: 7
Reg: Dec 27, 2012
Saskatchewan
1,920
like
01/02/13 01:50 PM (13 years ago)
Hi Shenry, I think you might have a similar problem to what we've discussed in another thread (https://www.buzztouch.com/forum/thread.php?tid=CE03439B30F38253D4CEA99&fid=06DB0BCB08E2222&sortColumn=FT.id&sortUpDown=DESC&currentPage=1). If you XCode 4.2 can I assume you've got OSX Snow Leopard and iOS SDK 5.0? My build errors stopped when I upgraded to iOS SDK 6.0 but I still have the error when I launch the app in the iPhone simulator.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.