I'm getting close to being ready to submit my first app to the AppStore. I have pretty much finished the full feature version. Now I need to add advertisements and limit the number of items that are in the Lite version. I knew that in order to do this, I would like to share the same source files, but have some preprocessor conditionals for the Lite version.
I first searched for #ifdef and Objective C on Google. This got me part of the way there, but then I realized that the way to do it is using different targets in Xcode. Here is a very useful blog entry that explains how to do it:
http://www.pacificspirit.com/blog/2009/01/27/building_for_multiple_iphone_targets_in_xcode
And here's a site that does the same thing with screenshots:
http://adeem.me/blog/2009/05/03/tutorial-part-2-same-xcode-project-create-multiple-products-for-iphone-using-script/
Monday, May 25, 2009
Monday, May 11, 2009
Static Methods
One more tip. If you're looking for how to create static methods that can be called without an instance of the class being initialized, it's pretty simple. (I wish I hadn't spent an hour trying to find it.)
Use the (plus) + in front of your method instead of the (minus) -
Example (assuming your class name is MyClass, and this method is defined within the implementation):
This method can be called in your code without instantiating anything like this (assuming #define kMyClassTypeFoo 1 is in the header):
Hopefully that's a time-saver for someone.
Use the (plus) + in front of your method instead of the (minus) -
Example (assuming your class name is MyClass, and this method is defined within the implementation):
+(MyClass *)getMyClassInstanceOfType:(int) myClassTypeID
{
MyClass *retMyClass = [[MyClass alloc] init];
switch(myClassTypeID)
{
...
}
return retMyClass;
}
{
MyClass *retMyClass = [[MyClass alloc] init];
switch(myClassTypeID)
{
...
}
return retMyClass;
}
This method can be called in your code without instantiating anything like this (assuming #define kMyClassTypeFoo 1 is in the header):
MyClass *myClass = [MyClass getMyClassInstanceOfType:kMyClassTypeFoo];
Hopefully that's a time-saver for someone.
Development Tips
First, the gripes:
Home, End. AAAAAAH! I've found myself at the beginning or end of the file so many times I'm pulling my hair out. I'm trying to learn the xCode keystrokes rather than just remapping to my Visual Studio keystrokes so that I can work on any Mac. It is costing me tons of grief. Anyway, here is a nice pdf that Colin Wheeler put together that I've found very helpful:
http://www.1729.us/xcode/Xcode%20Shortcuts.pdf
It's printed and mounted above my computer. (Click the image for a full-size png).
BTW, it's "command-left-arrow" and "command-right-arrow" for home and end. Also, "control-/" is critical for going to the next auto-completed parameter. And, if you haven't found it yet, Esc does code completion (rather crappily!)
Seriously, how about any code completion whatsoever on protocols! If you implement a protocol, you won't have any idea if you are overriding a valid method or not. No syntax highlighting...nothing! The code sense is worse than Visual Studio 5. It's worse than UltraEdit. It's plain bad. Here's hoping that iPhone dev popularity will force some changes to that feature of Xcode.
Anyway, I may have led subversion client seekers astray. Unfortunately, SCPlugin does not automatically detect files that need to be added. This functionality is ABSOLUTELY NECESSARY in any good revision control client. It at least needs to tell me which ones I haven't added yet, even if I choose not to add them. I may have to try Versions.
My goal is to have my first app submitted to Apple by next Monday. More later...
Home, End. AAAAAAH! I've found myself at the beginning or end of the file so many times I'm pulling my hair out. I'm trying to learn the xCode keystrokes rather than just remapping to my Visual Studio keystrokes so that I can work on any Mac. It is costing me tons of grief. Anyway, here is a nice pdf that Colin Wheeler put together that I've found very helpful:
http://www.1729.us/xcode/Xcode%20Shortcuts.pdf
It's printed and mounted above my computer. (Click the image for a full-size png).
BTW, it's "command-left-arrow" and "command-right-arrow" for home and end. Also, "control-/" is critical for going to the next auto-completed parameter. And, if you haven't found it yet, Esc does code completion (rather crappily!)
Seriously, how about any code completion whatsoever on protocols! If you implement a protocol, you won't have any idea if you are overriding a valid method or not. No syntax highlighting...nothing! The code sense is worse than Visual Studio 5. It's worse than UltraEdit. It's plain bad. Here's hoping that iPhone dev popularity will force some changes to that feature of Xcode.
Anyway, I may have led subversion client seekers astray. Unfortunately, SCPlugin does not automatically detect files that need to be added. This functionality is ABSOLUTELY NECESSARY in any good revision control client. It at least needs to tell me which ones I haven't added yet, even if I choose not to add them. I may have to try Versions.
My goal is to have my first app submitted to Apple by next Monday. More later...
Subscribe to:
Posts (Atom)