Wednesday, April 20, 2011

Using AppCode from JetBrains for iOS development

Since Xcode annoys me so much I though I would give AppCode from JetBrains a shot even though it is alpha code. I must say so far I am impressed. Not a single crash after have used it for a day and it does solve a number of complaints I have about Xcode.

What is it that I like?

Can reformat your code. Easy to set up the rules, works as expected. I finally took the time to clean up the look of some older code to match our current standards.

Auto imports and uses current Xcode settings. It all just worked when I pulled up my existing project.

SVN works like I expect it to work. So much nicer than Xcode.

Groups sorted alphabetically. Gee, who would every think that could be handy?

Nice color coding in the IDE. More things are colored making them stand out as they should.

Much better static code analysis. Sure some of it is a bit overkill but I found a lot of useful issues that I have cleaned up in the code. It even spots unused includes, tells you when you synthesis a variable but never really declare it, signed / unsigned mis-matches, unneeded typecasting, things you might not be cleaning up in your dealloc, etc.

If you start using a class that you have not imported yet a simple Ctrl + ENTER adds the import to the file.

Editor tabs the way I expect them to work, open a file and it stays open, editor does not replace it during debug or any other time it sees fit.

When you are in the debugger it shows you the actual content of your variables. Take that Apple, I can see what is my NSArray! I can look at strings, integers, booleans etc. How novel!

Column block editing mode. Nice when you need to delete a hunk of code out the middle of a bunch of lines of code. Most editors support this, as far as I know Xcode does not.

I am guessing there is ton of other stuff it does too. Right now it appears to be a keeper. We use IntelliJ for our main Java application so I pretty much know my way around a JetBrains IDE which is a help.

Downside - still uses Xcode Interface Builder (can't blame them here, who would want to rewrite that) so it will fire up Xcode if you attempt to edit an XIB file. Not like I do that very often, generally you create one then spend most of your time coding for it.

I will post more as I get more use out of this IDE. Nice to see some competition in this arena for Apple finally.

Monday, April 18, 2011

Hit my first bit of iOS fragmentation

Yes there is fragmentation on the Android side of things. I have code in place to check for DPI of the device to tweak things in my custom controls. There are also issues on the iOS side of things so let's just cut the crap here Apple.

I have a UIAlertView with a text entry field in it. Under iOS 4+ it works fine. The UIAlertView is moved up and out of the way of the on-screen keyboard. Under iOS 3.x it is hosed. Since Apple leaves things centered on screen keyboard or not adding a control to an UIAlertView hoses you. Used to be people could not even get the UIAlertView to rotate. Nice UI there Apple, even today you can't rotate the simple calendar.

I can get it to work if I lock into a mode - portrait or landscape - but if the user rotates during the view I can't figure out a way to move the current UIAlertView. I have a pointer to it, I can run transforms on it, I can reset its center but nothing has any affect once it is on screen. Sure, the OS will move it about but I can't get it to move.

Time to punt and move on. I will just have our app require iOS 4+ as most phones run this and we are targeting Doctors who tend to upgrade at will.

I do see various posts on how to add code to check for older iOS versions. There is fragmentation on the iOS side of things. The original iTouch and iPhone are stuck in 3.x land never to move forward. As a developer you have to decide when to punt. We support Android 1.6 and newer only. That is a pretty old version. 3.x is not that old but also not worth too much hassle in the big picture.

Even Xcode does not what you playing back in 3.x land. They have one emulator - a combination 3.2 for the iPad and iPhone. You get to 2x your iPhone app to test it. Screw those bastards! Hell their battery should have died by now anyway right?

Friday, April 15, 2011

First iOS app accepted and available on App Store

After a full week Apple has approved version 1.1 of our application and published it on the App Store. Very happy to have it make it through the process without a rejection. I did not work on 1.0 version and was not employed by the company at the time of its release. The person who wrote it is not around so I was going into the whole process blind. I made significant code changes to the 1.0 code base, this was not a minor bug fix release.

Before submission I read a lot of sites covering rejections. I found out RegexKitLite usage could kick you out for private API usage so I pulled its needs from the product. Turns out the one area I was using it I really did not need for users in production meaning I could pull it without replacing it. I also found an on-line tool that scans your code looking for private API calls and it found none so I felt pretty good about this area.

I located the list of icon sizes for both iPhone and iPad and I included every one of those. Since I was in the graphics area I also updated everything for the Retina display which I was able to test in the simulator and then on the new iTouch we purchased.

Even though the 1.0 version was already out in the store we did not feel the network handling code was the best. This is an area Apple can get picky about so I gave it a solid once over and cleaned up areas that did not handle network connection loss. I also dealt with multi-tasking as your data could be stale if you pushed the application to the background for any length of time. I auto refreshed the appointment list when the app came back to the foreground.

I ran the memory analyzer and cleaned up all the potential memory leaks found by the static checker and then ran the application multiple times to make sure no leaks showed up during run time analysis.

Our QA team gave it a beating too finding a few issues but it was pretty clean overall.

The confidence level was high at submission but so many have been rejected for oddball reasons I was still worried. The big one could be the new "limited audience appeal" rejection. Would they need to know how many doctors were going to use it? How many is too few? Could they force us into the ad hoc model? Glad that did not come into play.

Still don't care for it taking a week to get a 1.1 version posted. I guess you can try to have them push updates quicker when you run into critical bugs. That was not the case here, this was really a functionality improvement along with UI clean up getting it ready for the 2.0 release I am working on now that will add a lot of new functionality.

Back to work on the 2.0 version for me including new SQLite usage. I have already refactored that area twice and just now have it back up and running. I had to use NSZombieEnabled = YES to figure out that I was releasing an object too early. I also can't run my test code in the profiler and I need to figure out why that piece is annoyed. Xcode is a real PITA most of the time.

The Android version of the product, that I also wrote basically from scratch as there was no 1.0 version of that, released to the store in all of 20 minutes including account sign up. Of course we can update that pretty much instantly too. It just happens to be of less importance as most Doctors use the iPhone. We will release the 2.0 version to both platforms once I get it completed.

Thursday, April 14, 2011

Things I don't like about Xcode 4

I have spent the last couple of weeks coding heavily in Xcode 4.0.1 and be sure to upgrade as there are show stopping bugs in previous versions. My experience with Xcode has been less than wonderful over the past half year. There are a number of things that have been annoying me as of late. Might was well vent, why else would you have a blog?

Refactoring does not fully work. When I program in a new environment I want my code to look native. I don't want it to look like a Java guy is writing Java code in Objective C. On my first attempts to do things I have screwed up and named methods and classes poorly. I use Refactor to fix those transgressions. Of course it does not rename everything. In Eclipse I have not had a refactor fail to catch everything that I can remember. Basic steps in Xcode are refactor, build, fix all the errors it left. This is not how an IDE should work. Since you get a preview dialog during refactoring they could add a "do this one" check list it they think something is iffy, instead they do the simple and blow everything else off.

Attempting to change method signatures sucks. Let's say I have initWithTitle and I need to update a line of code to become initWithTitleAndFlags. When I start typing "AndFlags" it wants to put in ALL the parameters, even the ones shared with the original. I have to delete all the crap it added incorrectly each time. It gets really annoying when the IDE attempts to outsmart your typing.

Scrolling through the document with keyboard navigation does not move the text cursor. If I use fn + up arrow to go up a page I expect the text cursor to be on the page I am viewing ready to type. Instead my view just scrolled up a page but my text cursor did not move. I have to click to move the text cursor. To me that is a waste of time and not how pretty much every other editor works.

I use multiple tabs and I am very happy they added tab support to Xcode 4. I have them all open in the order I want then I start debugging. Lets say I have "CaseItem.h" "GroupSet.m" and "GroupHeader.m" in tabs. The active tab is "GroupSet.m" and I run the program. It crashes in "GroupHeader.m", what do my tabs look like? Did the IDE switch over to the already open tab for "GroupHeader.m"? No, that would make sense, instead I get "CaseItem.h" "GroupHeader.m" and "GroupHeader.m" which totally screws up the tabs I had open. Would it have been so hard to find the tab with the file already open in it? Other IDEs do that for me.

The left side view - showing the class list, search, debug etc. stuff, changes based on which tab you select. Of course the debugger changes it too as do other processes. It hardly seems like you own this window. Every tab has its own last setting. Just when I think I expand the class view to show the things I am working on I switch to another tab and it changes. The debugger takes over but when the debugging session ends the window is blank so I have to switch back to the class view. Doing a search leaves the results for some limited amount of time that I can't figure out. I end up redoing searches over and over as the context seems to go out of scope just when I am narrowing down to what I want.

For consistent UI look there is another fail. The Editor and View button sets in the upper left corner appear to be group toggle buttons. The Editor buttons are, only one button can be depressed but the View buttons are not, you can do one or more of the buttons depressed. I don't see a visual difference in the control to let me know that.

On the View side of things I want to see the Utilities pane only when I am on an XIB file but once I turn it on for a tab it stays there for XIB, H and M files. That view sucks for H and M files because as I type it is updating with some sort of help system which I find very distracting. When I am typing code I don't want the editor to be constantly flashing new text in other areas of the screen.

It can't always uncomment code.

// [self goBoom];

   // [self goBoom];

The first line will uncomment with CMD + / but the second line with not because it starts with SPACES. Gee boys, how hard is this to figure out? Nice to make me strip leading spaces to make a keyboard shortcut work.

Classes in sorted order? Sorry bub, do it manually. I have my classes organized in various groups but the files in each group are not sorted and as far as I can tell there is no way to sort them without manually dragging and dropping them. There was a way to do it manually in Xcode 3.x but that has been removed from 4. Why remove it? Why not leave it and enhance it allowing you to turn on an auto sort mode? Look I totally get it if you don't want them in a sorted order, that should be an option, but no way to sort is stupid.

One click zone for both break points and error / warning indications. How many times have I tried to click on the red error icon in the line number gutter but instead I get a breakpoint set? Too many to count especially when using the touch pad. I have an external mouse attached meaning I use it more and more to do things as the touch pad is not as accurate and I end up doing things I don't mean to do like setting a stinking break point. To unset the damn thing I have to click, hold and drag it away. What a cool animation and sound I get for my effort but what a waste of time and mouse movement to do it.

Doing a New File..., telling it which class you are deriving from and having it create the files with errors. Gee thanks for asking what I am deriving from and then NOT including the header file so the first thing I do with a new file with a few lines of code is fix it. Love that auto code generation. Nice taking it that extra mile.

Code reformatting, can a brother have some? Really this should be part of any IDE. I have to reformat all the auto-generated code as we don't put the opening { on the a line by itself. Yes, there are some third party tools but I really should not have to go through that when using a Professional IDE. Oh wait, it is free, so maybe it is not Professional? There are a ton of free IDEs that support this right out of the box.

Plug-in support. Again why write an IDE that does not support plug-ins? That way you don't have to write everything, the programming minions will fill in the holes. I have written plug-ins for Eclipse and for IntelliJ. I have downloaded and used a metric boatload of plug-ins for both. It is awesome. Damn you Apple, you only give us one IDE and we are only allowed to run it your way.

SVN integration is crappy. It does a poor job with even the simple tasks of adding new files or deleting files from the repository. I end up doing a good chunk of my SVN processing outside of the IDE. That is just sad. I can't believe the IDE can't handle deleting files and keeping SVN up to date. I must manually do the "svn rm {file}" every time. Do iOS developers never remove files?

I find Xcode 4 to be sorely lacking as an IDE. I have no hopes of Apple fixing any of the short comings. It is free to anyone paid and signed up for the developer program and competition free so why should they bother? Maybe in house they have some other better tools. Maybe other companies have found other editors to use. People are pumping out apps for iOS using this POS and for many it appears this is the only IDE they have ever used so they think it is perfect as they don't have anything to compare it against. I have used a number of other tools and Xcode pales in comparison.

Tuesday, April 12, 2011

Life with Xoom

I broke down and bought a Xoom. Actually I bought it for my wife for her birthday. She has an Android phone and uses it all the time. She also has a nice HP laptop that is running most of the time. She is a stay at home mom but probably gets more done in office productivity apps than I do. She really knows her way around Excel and Word.

Why get the Xoom? I have had much better luck with Android over iOS. I liked the higher resolution screen and the choice of Flash. Various web sites, including Soap Opera Digest - one of her favorites, use Flash. So do a number of kid sites like Nick Jr. I don't care for Flash as I think too many have abused it but that does not mean I refuse to use it in the proper situations. So far the sites I have visited that need Flash have run without a hitch.

My wife tends to fall asleep well after I do. She has been using her phone while laying next to the me in bed before she nods off. She likes to read email, scan various websites and wants to save tree via eBooks. She also wants a second monitor at times for her laptop. She also loves the instant on of the phone to check weather and email but, like me, does not like to type anything more than a few sentences on a tiny keyboard. Now she can read even more sites, actually respond to email and wants to buy some eBooks.

For these needs the Xoom appeared to be a really nice fit. So far that has turned out to be the case. I love the instant on, the ability to hold it in one hand and read websites, the fast enough typing speed (not full touch typing but fast two finger typing). There are a number of fun games to play on it and the games are more enjoyable in the large format. Angry Birds is great, you do have to manually zoom out every level which is annoying but being able to see the whole level for each bird shot is very helpful. Setting up multiple email account was easy as is switching between them.

I used the about:debug setting of the browser to tell the world I am a desktop instead of a phone and most sites agree and show me a full web experience. I tried Opera and thought it was OK and FireFox which appears to work decently. FireFox does not scale images all that great, might no be using the GPU where the built in browser does.

Kids enjoy it, hit power, check homework central, grades, search for essay information all from anywhere in the house. It has become the family pass around machine. Battery life has been great. Even Angry Birds does not kill the battery like my phone does.

We went WiFi only. Did not want another data plan in the house. Might pick up a BlueTooth keyboard at some point.

Downsides - Honeycomb does not seem to be finished. I am really hoping since Motorola went vanilla here that I will get upgrades as soon as Google has them available. I like a lot of the things they did but you have to not think it will be just like your phone. Various parts of the UI have moved. It has crashed a couple of times and I have had programs running in the background playing sounds that you can not see in task manager so I had to do a reboot. The browser will crash too, that is why I have been playing around with Opera and FireFox.

I am converting my Android phone game - Grid Hunt - to Honeycomb. Lots of cool things in the API including fragments. It is nice to have so much more screen space to be able to display more game information. I plan on adding multiple player settings, two player mode and more scoring statistics.

There is one area I think all tablets are failing at - supporting multiple users. All are just like a phone, power it on, you are the one user. I want my wife and I to have separate desktops layouts, default tabs open in the browser, default email settings etc. I don't care about switching users with both logged in at same time, just log one out and the next one in - basically reload settings. I know just sharing it playing games between my son and I would be a big help. Right now Stupid Zombies has many completed levels I have not actually played.

I do like that I was able to connect to our network drives via SMB easily. I can copy files from the Xoom to the network to back them up, look at many files (DOC, XLS, PDF, etc.) right off the network on the device etc. We keep most of our documents on the network drive at home as it is backed up regularly.

I rarely am a first adopter of anything. This was a great gift for the wife / family. It gives me a chance to convert my game and be in on the early set of Android 3.0 ready applications. I really hope it gets a number of updates from Google / Motorola. It is very useful as is but needs tweaks before I would recommend it to less tech savvy friends and family. I am happy with the purchase but really want some updates to fix the crashes and to tweak the UI.

My neighbor bought the Samsung tablet in late January. I was telling him about the Xoom when he dropped by to borrow my power washer and he thought it sounded pretty cool. He is very happy with his tablet in that his work provided laptop can take 10 minutes to fire up due to all the corporate crap it must run and it being low on physical memory. He has a standard 8 AM meeting with a spreadsheet. He fires up the tablet, has the spreadsheet ready to peruse and can have the laptop come on-line when it ready. He has gotten a lot of use from the tablet. I hope to feel that way months and years after my purchase too.

Wednesday, April 6, 2011

My note to Apple after more Xcode pain

After having beaten my head against a wall for the last couple of hours I can not express how disappointed I am with Xcode and iOS development in general.

I just wanted to submit version 1.1 of my app to the app store. I had archived the app, or so it seemed, but I was unable to find the archive on disk to submit via App Loader. After searching the HD over and over having no luck I finally found a web posting stating that anyone who upgraded a project from Xcode 3.2 to Xcode 4.0 was hosed. You had to manually delete some settings from the project file to get the archive to appear in the Organizer.

Thanks so much for reporting success to me over and over when it really was not successful. That just makes my day. Don't report success if it does not happen. Please have your %$$#@ QA team test your products. Apple seems so worried about NDA on a stinking IDE that it really does not get tested. Please let people test this stuff before you waste so much of my time.

After I got the archive to work I pressed Validate and Xcode crashed. Next time I pressed Submit and it crashed again. I rebooted just in case the other work I had done had annoyed your fine IDE. Nice going QA, love that you did not test submitting an app via the IDE, the IDE I am forced to use to submit to the one app store out there. Again what a huge waste of my time.

I search the web again. Known problem. Fixed, I can only hope, in XCode 4.01. Yeah, thanks Xcode for NOT telling me an update was available.

I realize Apple users are too stupid to install patches. So nice of you to think about the dumb, the ones not already in your QA department, and force me to download 4.6g of Xcode for the 3rd time. Yes, I love hogging my bandwidth for 10 hours, please more sir.

You owe me about 30 hours of wasted time using your untested products so I can spend more money to submit them to the ONE and ONLY app store. I can only hope the updated app does not get rejected for some crazy reason. And I really hope the 4.01 works, I bet it breaks something else that will haunt my dreams.

It has not been any sort of pleasure working with Apple, Xcode or the Macbook. It took us over a month to get our simple account straightened out. Every interaction I have had with Apple has been painful. I don't find Mac products to be friendly or easy to use. In fact I hate them but it pays the bills so I work on both our Android and iOS apps. The Android side is so much more pleasant and easy to work with I can't even begin to tell you.

UPDATE: 4.01 did not crash when I pressed Validate but it showed yet another issue. I had to do some more web research to find out how to fix that. Validate passed, Submit worked and the app is out on the app store. Of course even after downloading 4.6g of crap it is now downloading iOS 4.3 library. Why is that not included in a 4.6g download already? When does "user friendly" have to equal "bandwidth stupid"?

What office hardware do you have?

When you only work on desktop or web applications your office space tends to stay pretty standard as far as hardware goes. Once you add mobile to your list things get out of hand.

I have my main development Win7 64-bit based PC with dual 20" LCD monitors. Attached to that is my wireless Sennheiser headphone base unit. Very happy with that device. I have a MS Natural 400 keyboard which really helps in wrists but does take up more room than a regular keyboard. Mouse mat with a gel wrist rest and a MS mouse. 

Sitting just to the right of all of this is my new Macbook Pro 15". I have an external mouse connected to that. While I like the touch pad it does not work very well when dragging items around and I don't like to use the keyboard and mouse just to open a link in a new window. If I need to do any graphics work the touch pad just does not cut it for me.

Laying about in various places I have my phone for hardware Android testing, a version 2 iTouch and a version 3 iTouch for camera code interaction. Behind the dual monitors there is a mini-hub and I have a power strip on my desk to plug-in the laptop each day. I take the Mac home at night allowing me to work from home if need be.

I have a stuffed Duke (the Java mascot) and a stuffed Android Robot, not sure if has a name? The cast of Futurama in diecast sits atop my mini-tower PC case.

Working in the land of mobile sure has added to the clutter. Previously it was just the main PC, now I have stuff scattered all about and I have to switch keyboards and mice often during the day. I find myself going for the wrong keys from time to time.

This does not even count the clutter of my on-screen desktop. I usually have Eclipse, Paint.NET, Pidgin, Media Monkey, PSPad, File Explorer, Chrome and at least one Android emulator running on my PC. On the Mac side I use Spaces and I have Xcode, IntelliJ, JEdit and Firefox running. Why not Chrome on the Mac? There is an extension for FireFox to handle SQLite files for FireFox that I use. During any given day various other programs and utilities are opened and closed.

I use PSPad and JEdit to keep open various files with code snippets and random thoughts for the platform I am on. If I think of something I need to add to the code late I just type in a note to myself. For PSPad I tend to have about 6 files open some with to do lists others with blocks of code I am experimenting with or code I downloaded from the web I am using for ideas. I just JEdit on the Mac as it was free. PSPad is great when I am experimenting in HTML as you can quickly type something in and run it to see how it looks.

My browsers tend to have a number of open tabs, work email, two personal email accounts, Java Docs, JIRA for bugs and some sites I have recently searched via Google. A few years back this would all have been system overload but now having files open all over the place seems to be the norm. I shut down the Mac every night but leave the PC running, just turning off the monitors as I leave. The Mac starts up plenty fast enough and having it at home is nice.