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...
Wednesday, April 22, 2009
iPhone Dev and Subversion
Well, I'm well underway with my first application that I plan to submit to the AppStore. After going through the very helpful tutorials in my favorite two iPhone books (Beginning iPhone Development: Exploring the iPhone SDK and The iPhone Developer's Cookbook: Building Applications with the iPhone SDK,) I got to coding my own apps. Of course, one of the first steps was to figure out...
Version Control
For all of our side projects, we use a Subversion repository for source control. I'll assume that my audience knows why version control is important and where they can find Subversion. What you may be looking for is a TortoiseSVN-equivalent, shell-integrated client for the Finder in OS X. I found one that has all of the basic functionality:
SCPlugin - the version I downloaded was SCPlugin-0.7.3l-SVN.1.6.0.pkg.
I've found this to be a very adequate svn client for everything with one inconvenience: SCPlugin doesn't handle svn:ignore. There is an open bug about it, but I don't think it's going to get attention very soon. It just means you have to remember NOT TO ADD your build folders when you add projects to the repository.
If you want a more full featured svn client that is a standalone app, people speak very highly of Versions. I haven't tried it, and I prefer the ease of doing everything right inside of Finder (or Windows Explorer,) so I probably won't.
After installing SCPlugin, I found myself needing to do a few things from the Terminal using svn. Unfortunately, the version of the client that is shipped with Leopard is 1.4.something. Here is a nice blog post that helped me get upgraded to the newest version in a few minutes: http://www.gridshore.nl/2008/12/21/upgrade-subversion-client-on-mac-osx/.
Version Control
For all of our side projects, we use a Subversion repository for source control. I'll assume that my audience knows why version control is important and where they can find Subversion. What you may be looking for is a TortoiseSVN-equivalent, shell-integrated client for the Finder in OS X. I found one that has all of the basic functionality:
SCPlugin - the version I downloaded was SCPlugin-0.7.3l-SVN.1.6.0.pkg.
I've found this to be a very adequate svn client for everything with one inconvenience: SCPlugin doesn't handle svn:ignore. There is an open bug about it, but I don't think it's going to get attention very soon. It just means you have to remember NOT TO ADD your build folders when you add projects to the repository.
If you want a more full featured svn client that is a standalone app, people speak very highly of Versions. I haven't tried it, and I prefer the ease of doing everything right inside of Finder (or Windows Explorer,) so I probably won't.
After installing SCPlugin, I found myself needing to do a few things from the Terminal using svn. Unfortunately, the version of the client that is shipped with Leopard is 1.4.something. Here is a nice blog post that helped me get upgraded to the newest version in a few minutes: http://www.gridshore.nl/2008/12/21/upgrade-subversion-client-on-mac-osx/.
Tuesday, April 7, 2009
Provisioning Profiles
OK. So, now I'm enrolled. I've done 7 apps on the iPhone Simulator as part of my switch-over training (I'm going through the tutorials in Beginning iPhone Development: Exploring the iPhone SDK ) And, like everyone else who had to wait a long time for their company to get enrolled, I was dying to see some of the sample apps run on my real iPhone instead of the simulator.
The process to do this is much more involved than one would think. I spent about 3 hours figuring it out, and then it took me all of 10 minutes to talk Russ (my co-worker) through doing it on his Mac/iPhone.
To give the context, let me put this a simply as I can:
There are 3 components contained in a Provisioning Profile:
I started by watching the videos on the right side of the iPhone Developer Program Portal. I found them to be very helpful, though they are missing some important information.
Here are a couple other sites that were very useful in figuring out how to create and install Certificates, AppIDs, Devices, and Provisioning Profiles:
I did have a problem with one of my projects that I had created in xCode. I did everything exactly the same in all the projects I set up for my phone. However, in one project, I get the following error EVERY time I try to Build and Run, regardless of if I have cleaned all targets or not:
I know I did everything exactly the same. There must be something different about the project file or something I'm including as a resource or something. I don't know, but I'd sure like to get it figured out. I spent way too long on it last night.
Anyway, this process was not as easy as I would have preferred, but, considering the newness of the SDK, it wasn't horrible.
The process to do this is much more involved than one would think. I spent about 3 hours figuring it out, and then it took me all of 10 minutes to talk Russ (my co-worker) through doing it on his Mac/iPhone.
To give the context, let me put this a simply as I can:
There are 3 components contained in a Provisioning Profile:
- Who can sign the code - (the valid Certificates)
- Which Application it's a profile for - (the App ID)
- What devices can install the App - (the Devices)
I started by watching the videos on the right side of the iPhone Developer Program Portal. I found them to be very helpful, though they are missing some important information.
Here are a couple other sites that were very useful in figuring out how to create and install Certificates, AppIDs, Devices, and Provisioning Profiles:
- http://www.talentgrouplabs.com/blog/archive/2008/08/21/preflightingapplication-errors-0xe8000001-and-others.aspx
- http://www.lensenergy.com/archives/2009/01/iphone-dev-tip1---applicationv.html
I did have a problem with one of my projects that I had created in xCode. I did everything exactly the same in all the projects I set up for my phone. However, in one project, I get the following error EVERY time I try to Build and Run, regardless of if I have cleaned all targets or not:
Your mobile device has encountered an unexpected error (0xE800003A)
ApplicationVerificationFailed
I know I did everything exactly the same. There must be something different about the project file or something I'm including as a resource or something. I don't know, but I'd sure like to get it figured out. I spent way too long on it last night.
Anyway, this process was not as easy as I would have preferred, but, considering the newness of the SDK, it wasn't horrible.
Monday, April 6, 2009
We're Enrolled!
It's official! The total time was 18 days from start to finish. Here are the last two updates:
4/6/09 - 10:30 AM (18 days) - I called the dev enroll number that was given to my wife at home on Friday to ask why my status was set to
Additional Information Needed.
I explained what point I was at, and apparently they had forgotten to verify my address or something. The nice customer service rep (who also had a Scottish accent) finished up everything that was necessary, and the next email came while I was on the phone with him.
4/6/09 - 10:32 AM (18 days) - I received an email titled iPhone Developer Program Enrollment Status with a link to accept the iPhone Developer Program License Agreement. Once I clicked through, it brought me back to the next stage of the enrollment process.
At that point, I just added the $99 Standard Program to my cart, paid for it, and waited for an activation code.
4/6/09 - 12:02 PM(18 days) - I received an email titled iPhone Developer Program Activation Code. This email said,
Thank you for applying to the iPhone Developer Program. To activate, simply click on the Activation code link below
(referring to a link with an activation number.) Once I clicked the link, it prepopulated a field on the apple dev site, and I clicked the activate button.
Done!
I can download the 3.0 SDK, add team members, etc.
Overall, it was not too bad. I think Apple needs to streamline it down to a 1-2 day process, but considering the number of developers jumping on this bandwagon, it's not horrible.
(This is a follow-up post to Enrolling My Company and Enrollment Status Updates)
4/6/09 - 10:30 AM (18 days) - I called the dev enroll number that was given to my wife at home on Friday to ask why my status was set to
Additional Information Needed.
I explained what point I was at, and apparently they had forgotten to verify my address or something. The nice customer service rep (who also had a Scottish accent) finished up everything that was necessary, and the next email came while I was on the phone with him.
4/6/09 - 10:32 AM (18 days) - I received an email titled iPhone Developer Program Enrollment Status with a link to accept the iPhone Developer Program License Agreement. Once I clicked through, it brought me back to the next stage of the enrollment process.
At that point, I just added the $99 Standard Program to my cart, paid for it, and waited for an activation code.
4/6/09 - 12:02 PM(18 days) - I received an email titled iPhone Developer Program Activation Code. This email said,
Thank you for applying to the iPhone Developer Program. To activate, simply click on the Activation code link below
(referring to a link with an activation number.) Once I clicked the link, it prepopulated a field on the apple dev site, and I clicked the activate button.
Done!
I can download the 3.0 SDK, add team members, etc.
Overall, it was not too bad. I think Apple needs to streamline it down to a 1-2 day process, but considering the number of developers jumping on this bandwagon, it's not horrible.
(This is a follow-up post to Enrolling My Company and Enrollment Status Updates)
Saturday, April 4, 2009
Starting Points
Here are a few of the best resources I found that have been very useful in making the transition to iPhone programming:
Beginning iPhone Development: Exploring the iPhone SDK - An outstanding tutorial for developers making a switch to iPhone development. I tried a few different books, but found this to be head and shoulders above the rest. Dave Mark and Jeff LaMarche have a refreshing, fun tone and give exactly the right amount of detail.
Cocoa Dev Central - Learn Objective C - A simple reference and introduction for programmers. This site assumes that you have some knowledge about other programming languages and about object oriented design. It introduces the Objective C syntax and explains some of the differences/similarities to other languages.
What are those little Xcode tips & tricks you wish you knew about 2 years ago? -A very useful collaboration of tips and tricks dealing with Xcode and Interface Builder.
appsamuck.com - 31 apps in 31 days. A great site with lots of useful sample code.
Beginning iPhone Development: Exploring the iPhone SDK - An outstanding tutorial for developers making a switch to iPhone development. I tried a few different books, but found this to be head and shoulders above the rest. Dave Mark and Jeff LaMarche have a refreshing, fun tone and give exactly the right amount of detail.
Cocoa Dev Central - Learn Objective C - A simple reference and introduction for programmers. This site assumes that you have some knowledge about other programming languages and about object oriented design. It introduces the Objective C syntax and explains some of the differences/similarities to other languages.
What are those little Xcode tips & tricks you wish you knew about 2 years ago? -A very useful collaboration of tips and tricks dealing with Xcode and Interface Builder.
appsamuck.com - 31 apps in 31 days. A great site with lots of useful sample code.
Friday, April 3, 2009
Enrollment Status Updates
Well, Apple contacted me today, and there was some good hope.
4/3/09 - 3:45 PM (15 days)- My wife took a phone call from my home (which is the official business phone number for the L.L.C.) I was given a number to call back, which I did. When I called the number, a nice gentleman with a Scottish accent took some information from me and then said that he would be able to move the process forward. He said that I would receive an email with further instructions in a few hours.
Unfortunately, I have not received any instructions, and my status on the iPhone Dev Center has changed to say
Additional information needed.
contact us
Bummer: so close. I will try contacting them and see what happens. Unfortunately, it is now 11:30 PM on a Friday night. I'm guessing I won't be getting anyone. Perhaps I'll hear something on Monday.
(This is a follow-up post to Enrolling My Company)
4/3/09 - 3:45 PM (15 days)- My wife took a phone call from my home (which is the official business phone number for the L.L.C.) I was given a number to call back, which I did. When I called the number, a nice gentleman with a Scottish accent took some information from me and then said that he would be able to move the process forward. He said that I would receive an email with further instructions in a few hours.
Unfortunately, I have not received any instructions, and my status on the iPhone Dev Center has changed to say
Additional information needed.
contact us
Bummer: so close. I will try contacting them and see what happens. Unfortunately, it is now 11:30 PM on a Friday night. I'm guessing I won't be getting anyone. Perhaps I'll hear something on Monday.
(This is a follow-up post to Enrolling My Company)
Enrolling My Company
When I got all excited about iPhone app development, I went straight to the iPhone Dev Center and started downloading the 2.2.1 SDK. I wanted to download the 3.0 SDK, but quickly realized that I needed to enroll in their dev program if I wanted to download. I knew that this step would be necessary, anyway, if I wanted to sell apps in the AppStore. I did not realize at the time that this would be a LONG process (much longer than I think it needs to be.)
Bear in mind that I am enrolling my company (an L.L.C.) instead of an individual. I have heard that the process is much shorter for individual registration. To try to help answer the question, "How long does it take?" here is a step-by-step log of what has happened to date:
3/19/09 (0 days) - I created my Dev Center account/profile and began the enrollment process to register my L.L.C. in the Standard Program. My status on the iPhone Dev Center was immediately changed to
Enrollment in identity verification stage.
I also received an email from iPhone Developer Program (noreply-iphonedev@apple.com) titled Enrollment Confirmation. This email had details about the program that I was trying to enroll in as well as an Enrollment ID.
3/23/09 (4 days) - I received an email from iPhone Developer Program (devenroll@apple.com) titled iPhone Developer Program - Additional Information Required (Enrollment ID: XXXXXXXXXX). This email requested that I send "one of the following forms of identity for your business" and then gave me a list of acceptable documents. Since my company is a L.L.C., I chose to fax my Articles of Organization, which were created when I created the L.L.C. and that showed me as a founding member.
At the same time, my status on the iPhone Dev Center changed to
Company documents needed.
3/26/09 (7 days) - I replied to the email that requested the additional information to confirm that they had received the faxed documents. I was concerned that since my status still said "Company documents needed" that they hadn't been received. No response...
3/30/09 - 3:04 PM (11 days)- I sent a second inquiry in response to the Additional Information Required email asking to confirm that they had, indeed, received the faxed documents.
3/30/09 - 3:54 PM (11 days)- I received a response from devenroll@apple.com with the same title as above. It gave me a follow-up number for future communication. Here's an excerpt from the response:
At the same time, my Enrollment Status on the iPhone Dev Center also changed to
Contacting your legal representative.
I have since been waiting for a contact from Apple.
4/3/09 - 8:57 AM (15 days) - I sent an email today asking how long this process of being contacted typically takes.
That's where I am so far--updates on responses/further steps to follow...
Bear in mind that I am enrolling my company (an L.L.C.) instead of an individual. I have heard that the process is much shorter for individual registration. To try to help answer the question, "How long does it take?" here is a step-by-step log of what has happened to date:
3/19/09 (0 days) - I created my Dev Center account/profile and began the enrollment process to register my L.L.C. in the Standard Program. My status on the iPhone Dev Center was immediately changed to
Enrollment in identity verification stage.
I also received an email from iPhone Developer Program (noreply-iphonedev@apple.com) titled Enrollment Confirmation. This email had details about the program that I was trying to enroll in as well as an Enrollment ID.
3/23/09 (4 days) - I received an email from iPhone Developer Program (devenroll@apple.com) titled iPhone Developer Program - Additional Information Required (Enrollment ID: XXXXXXXXXX). This email requested that I send "one of the following forms of identity for your business" and then gave me a list of acceptable documents. Since my company is a L.L.C., I chose to fax my Articles of Organization, which were created when I created the L.L.C. and that showed me as a founding member.
At the same time, my status on the iPhone Dev Center changed to
Company documents needed.
3/26/09 (7 days) - I replied to the email that requested the additional information to confirm that they had received the faxed documents. I was concerned that since my status still said "Company documents needed" that they hadn't been received. No response...
3/30/09 - 3:04 PM (11 days)- I sent a second inquiry in response to the Additional Information Required email asking to confirm that they had, indeed, received the faxed documents.
3/30/09 - 3:54 PM (11 days)- I received a response from devenroll@apple.com with the same title as above. It gave me a follow-up number for future communication. Here's an excerpt from the response:
Thank you for contacting the Apple Developer Connection regarding the iPhone Developer Program.
We can confirm that we have received your business documentation. We are currently reviewing your application and will contact you with further information regarding your application status as soon as it becomes available.
I hope you find this information useful. Please let me know if you have any further questions.
At the same time, my Enrollment Status on the iPhone Dev Center also changed to
Contacting your legal representative.
I have since been waiting for a contact from Apple.
4/3/09 - 8:57 AM (15 days) - I sent an email today asking how long this process of being contacted typically takes.
That's where I am so far--updates on responses/further steps to follow...
Why this Blog?
A few co-workers and I have recently become very excited about developing iPhone Apps. I have seen a few other blogs out there, and I have found the information that other developers like me have posted to be very useful. My hope is that this information can be useful to other developers out there that are making the transition.
I should start by saying that I have worked as a software engineer for the past 13 years. I have primarily used C++, C#, Java, Javascript, and Lingo, with most of my experience coming in C#. I love Visual Studio, and have been primarily Windows the entire time.
I am a co-founder of a small software company that has about $10-$12 million in annual revenue. I am doing the iPhone development on the side for additional income and for fun.
Through my current position, I have some limited Mac development experience. (I have helped to maintain our Mac client software for the last couple years.) However, realistically, I knew zero Objective C, and very little about xCode or Interface Builder prior to about 2 weeks ago.
I was just a little too young to catch the .com wave, but I'm not going to miss the mobile applications boom. There is going to be way too much money to be made for me to pass up the opportunity.
So, that's my background and why I'm writing. I hope you find it to be helpful.
I should start by saying that I have worked as a software engineer for the past 13 years. I have primarily used C++, C#, Java, Javascript, and Lingo, with most of my experience coming in C#. I love Visual Studio, and have been primarily Windows the entire time.
I am a co-founder of a small software company that has about $10-$12 million in annual revenue. I am doing the iPhone development on the side for additional income and for fun.
Through my current position, I have some limited Mac development experience. (I have helped to maintain our Mac client software for the last couple years.) However, realistically, I knew zero Objective C, and very little about xCode or Interface Builder prior to about 2 weeks ago.
I was just a little too young to catch the .com wave, but I'm not going to miss the mobile applications boom. There is going to be way too much money to be made for me to pass up the opportunity.
So, that's my background and why I'm writing. I hope you find it to be helpful.
Subscribe to:
Posts (Atom)