David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
09/13/12 10:02 AM (13 years ago)

Data Format String Warnings.

I posted these same comments in a similar discussion but thought my comments were important enough to create a new thread: https://www.buzztouch.com/forum/thread.php?tid=359E5C77E2175F0332B7CAF From the other discussion titled "Data argument not used by format string" ------------------------------------------- Yup...this is something that has been showing up on machines running Mountain Lion and the newest version of Xcode. Initially, after some testing, I thought this was an issue related to some new functionality in iOS / Xcode / Mountain Lion. Like deprecated methods and the like. These kinds of things happen every time a new version of iOS is nearing release and we find / fix / update all sorts of stuff each time. BUT, this is NOT the case with what you are seeing. You are seeing ACTUAL SYNTAX ERRORS in some of the method calls to the BT_debugger class. The BT_debugger class is the file that outputs all the friendly and helpful messags to your output console when your app is running. We use it literally hundreds of times in the code to help all of us understand what the software is doing. It appears that the newest version of Xcode is doing BETTER at not only finding small issues like this, but also warning us about them. This is a good thing. The issues it's reporting are NOT preventing the app from executing but DO need fixed. I've found most of them but have not begun rolling out fixes yet. I plan to roll out these fixes when iOS 6 is released. These, along with some others we're unaware of yet. These are related to method calls like this: [BT_debugger showIt:self:[NSString stringWithFormat:@"Done loading": %@", @""]]; There is nothing wrong with that statement and it has no syntax errors. Xcode will not report anything like it. However, this is wrong.... [BT_debugger showIt:self:[NSString stringWithFormat:@"Done loading": @", @""]]; and WOULD issue a warning and SHOULD issue a warning. It's not proper code! The missing % (percent sign) in front of the second @ character makes it invalid. This is totally our fault, it's a typo that I must have made a very long time ago. Because the older Xcode didn't warn us, or anyone else, it has gone unnoticed. After digging around for a bunch of hours, I'm estimating that there are about 9 of these occurrences (missing %) in about 7 different files in the project. There could be more, or less. I'll find them all and roll out the fixes when iOS 6 is released. In the meantime, you're welcome to simply add the missing % sign in each method call showing a warning. Or not, the project will compile fine with these warnings. Like I said before...errors and warnings are GOOD because they help developers like us (and you) find simple errors, improve our code, and therefore improve the overall performance of our software. If you spent a day with me in the office, you'de hear: "Old code is good code and we are still young" at least a dozen times :-)
 
MadRod
Aspiring developer
Profile
Posts: 1853
Reg: Apr 12, 2012
Lisbon
27,930
like
09/13/12 10:11 AM (13 years ago)
Thanks David.
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
09/13/12 10:17 AM (13 years ago)
Will do.. haven't updated to the latest version of xcode yet ;p David buzztouchmods.com
 
3laine3
Lost but trying
Profile
Posts: 1
Reg: Aug 27, 2012
Johannesburg
2,010
like
09/13/12 10:08 PM (13 years ago)
Thank you David! :)
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
09/13/12 11:11 PM (13 years ago)
Using David's clues, for many of my warnings, I did this: 1. Replaced the stringWithFormat with stringWithString 2. Deleted the 2nd parameter of , @"" 3. Accepted Xcode's help in getting rid of the redundant stringWithString
 
JimmySaver
Aspiring developer
Profile
Posts: 187
Reg: Apr 09, 2012
location unknow...
5,870
like
09/14/12 04:12 AM (13 years ago)
Thanks for the clarification on this David. I've been editing these 'errors' before submission with the help of this forum. It's good to know where the warnings are coming from. The only downside is I was quite merrily slating Apple / Xcode for this, so I guess I'll have to stop the badmouthing!
 

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.