pkdeveloper
Code is Art
Profile
Posts: 29
Reg: May 16, 2012
Washington, DC
4,640
07/31/12 08:36 AM (13 years ago)

Upgraded to Mountain Lion & Xcode 4.4 and Now MAJOR bug issues

I updated to mountain lion from snow leopard. I got the latest and greatest from Xcode (4.4). Now, I have like 10 warnings and 7 issues. The app is not pulling from online where I have saved several images either. I have figured out the warnings. Apparently the "%" isn't being added to NSString classes when used. But the parse issues... I don't know. Any ideas would be REALLY helpful. This is the code (I have comment-caps the issue areas: //get path to a named file... +(NSString*)getFilePath:(NSString *)fileName{ //ISSUE HERE!!! NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *filePath = [documentsDirectory stringByAppendingString:@"/"]; filePath = [filePath stringByAppendingString:fileName]; return filePath; } //gets path to a file in the bundle +(NSString*)getBundlePath:(NSString *)fileName{ //ISSUE HERE!!! NSString *defaultFilePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:fileName]; return defaultFilePath; } //does named file exist on writeable file system... +(BOOL)doesLocalFileExist:(NSString *)fileName{ //ISSUE HERE!!! //[BT_debugger showIt:self:[NSString stringWithFormat:@"doesLocalFileExist: %@", fileName]]; BOOL success = FALSE; if(fileName != nil && [fileName length] > 1){ NSFileManager *fileManager = [NSFileManager defaultManager]; success = [fileManager fileExistsAtPath:[self getFilePath:fileName]]; if(success){ [BT_debugger showIt:self:[NSString stringWithFormat:@"File does exist in cached directory: %@", fileName]]; success = TRUE; }else{ [BT_debugger showIt:self:[NSString stringWithFormat:@"File does not exist in cached directory: %@", fileName]]; success = FALSE; } } return success; } //does named file exist in the applications bundle... +(BOOL)doesFileExistInBundle:(NSString *)fileName{ //ISSUE HERE!!! //[BT_debugger showIt:self:[NSString stringWithFormat:@"doesFileExistInBundle: %@", fileName]]; BOOL success = FALSE; if(fileName != nil && [fileName length] > 1){ NSFileManager *fileManager = [NSFileManager defaultManager]; success = [fileManager fileExistsAtPath:[self getBundlePath:fileName]]; if(success){ [BT_debugger showIt:self:[NSString stringWithFormat:@"File does exist in Xcode bundle: %@", fileName]]; success = TRUE; }else{ [BT_debugger showIt:self:[NSString stringWithFormat:@"File does not exist in Xcode bundle: %@", fileName]]; success = FALSE; } } return success; }
 
pkdeveloper
Code is Art
Profile
Posts: 29
Reg: May 16, 2012
Washington, DC
4,640
like
07/31/12 08:38 AM (13 years ago)
Also, the issues are the same for each line (there are two for each of these lines): "Expected a type" "Missing context for method declaration"
 
theMonster
Code is Art
Profile
Posts: 435
Reg: Oct 18, 2011
US
8,050
like
07/31/12 01:54 PM (13 years ago)
Hmmmm..... Ok, so all of these methods are probably outside two lines of code that they need to be inside of, the first is: "@implementation" and "@end". Make sure that all this code has those two lines of code. As far as the "expected a type error", I'm not quite sure what the problem is there. It might go away when you do the previous.
 
pkdeveloper
Code is Art
Profile
Posts: 29
Reg: May 16, 2012
Washington, DC
4,640
like
08/03/12 12:31 PM (13 years ago)
You have been so helpful! There is one last question I have. Xcode is still flagging the following: //check bundle first.. if([BT_fileManager doesFileExistInBundle:[self saveAsFileName]]){ [BT_debugger showIt:self:[NSString stringWithFormat:@"Attaching data from file in Xcode project: %@", [self saveAsFileName]]]; tmpAttachmentData = [NSData dataWithContentsOfFile:[BT_fileManager getBundlePath:[self saveAsFileName]]]; }else{ [BT_debugger showIt:self:[NSString stringWithFormat:@"Attachment data does not exist in Xcode project: %@", [self saveAsFileName]]]; if([BT_fileManager doesLocalFileExist:[self saveAsFileName]]){ tmpAttachmentData = [NSData dataWithContentsOfFile:[BT_fileManager getFilePath:[self saveAsFileName]]]; }else{ [BT_debugger showIt:self:[NSString stringWithFormat:@"Attachment not found in cache: @", [self saveAsFileName]]]; //ISSUE HERE!!! } } The issue is "Data argument not used by format string." Again, this showed up during the move to 4.4. This is the only outstanding issue and my program is running. However, want to tie up any lose ends. Thanks!
 
theMonster
Code is Art
Profile
Posts: 435
Reg: Oct 18, 2011
US
8,050
like
08/03/12 12:44 PM (13 years ago)
Do you see where it is just a @ sign in between the two @" and "? Put a % before the @ sign.
 
theMonster
Code is Art
Profile
Posts: 435
Reg: Oct 18, 2011
US
8,050
like
08/03/12 12:44 PM (13 years ago)
Do this for each line with the error
 
pkdeveloper
Code is Art
Profile
Posts: 29
Reg: May 16, 2012
Washington, DC
4,640
like
08/07/12 08:17 AM (13 years ago)
Thanks for the input. Unfortunately it doesn't work. I understand adding the %@ for designation but the quotations are not correct. This is what it looks like: }else{ [BT_debugger showIt:self:[NSString stringWithFormat:@"This app does not use a splash screen", @""]]; } You'll notice that their are two quotations at the end. When I add the % sign, I get a parse error (expected expression). When, I remove one of the quotes and add the % I get the same thing, just more parse errors. Ugh. Extremely frustrating this line of code... Thanks again!
 
theMonster
Code is Art
Profile
Posts: 435
Reg: Oct 18, 2011
US
8,050
like
08/07/12 02:06 PM (13 years ago)
Ok, there just turn this: [BT_debugger showIt:self:[NSString stringWithFormat:@"This app does not use a splash screen", @""]]; To this: [BT_debugger showIt:self:[NSString stringWithFormat:@"This app does not use a splash screen"]];
 
pkdeveloper
Code is Art
Profile
Posts: 29
Reg: May 16, 2012
Washington, DC
4,640
like
08/16/12 09:59 AM (13 years ago)
YES! Totally working now! Thanks theMonster!
 
theMonster
Code is Art
Profile
Posts: 435
Reg: Oct 18, 2011
US
8,050
like
08/16/12 10:15 AM (13 years ago)
No problem, you technically don't even need that code. All it does is post messages to the console in xcode.
 

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.