Writing iPhone applications for jailbroken iPhones

As a developer I don’t enjoy paying for things when I don’t have to. One of them happens to be Apples iPhone Developer program. I could find better ways of spending $99. Debugging my own stuff isn’t one of them. So what is a developer to do when he can’t or won’t pony up the money to be allowed to load and debug his own applications. He uses that tiny developer brain to bypass all the checks that’s how.

I’m not going to go into the ins and outs of jailbreaking the iPhone. There are plenty of tutorials on the net to do exactly that. If you are in over your head at this point you should probably bail now, shit is definitely not going to get easier from here on out.

Creating a certificate

You’ll need your own self-signed certificate. iPhone OS will check for it, jailbreaking will tell it that it’s good, regardless of who it came from. So crack open Keychain access and create one for yourself. It’s in /Applications/Utilities/Keychain Access.app. From the menu choose Certificate Assistant > Create Certificate.

keychain_access_1.png

Give it the name “iPhone Developer” and check overide defaults.
certificate_1.png

Give yourself enough time. 10 years sounds about right. And change the type to Code Signing.
certificate_2.png

Add as much or little information as you want to the personal information screen.
certificate_3.png

After here, click next until the end. It should be shown in your Keychain Access application list.
keychain_access_2.png

Update the Developer stack

We’ll need to make a modification to the Info.plist of the SDK. Go to /Developer/Platforms/iPhoneOS.platform. Create a backup of Info.plist and open the original in Property List Editor. Change all instancese of XCiPhoneOSCodeSignContext to XCCodeSignContext. There are 3 instances of them in SDK 3.1.2. There might be more or less in future versions.

Back to XCode

In XCode open your project and change the Active SDK to iPhone Device – 3.1.2. Run the build command with Command-B. Go to the Directory with your project, open the build folder and into the Release-iphoneos or the Debug-iphoneos folder you’ll find the executable. We’re going to need to get this file into the iPhone.
project_folder.png

Copy your application to iPhone

You won’t be able to get your application onto the phone using the normal channels. iTunes won’t allow it. So the alternative is to copy it to the phone using SSH or iPhone Explorer. As with all things Mac, iPhone Explorer provides a GUI. And a GUI is always handy. Using iPhone Explorer go to the /Applications folder on the device. And upload your app folder. When complete it should appear like this. In some cases the app won’t be set to executable. If this is the case you’ll need to run the “chmod a+x” on the app folder to allow it to run.
explorer.png

Your application won’t be present on the springboard. For that you’ll need to restart the springboard. There are jailbreak applications that allow for this. You can also install the UIKitTools and run uicache from the commandline to update the springboard without restarting it.

Reblog this post [with Zemanta]

Getting started on the iPhone SDK

Last night I bit the bullet and downloaded the iPhone SDK to my Mac. It includes the new XCode 3.1 so that and all the files were updated as well. On a side note it reinstalled CHUD which was giving me errors since upgrading to 10.5.3. Now I can disable 3 of my cores and see how a single 2.4GHz Kentsfield really work. It was still very useful and quick running on just one core. I wouldn’t try that with VMWare Fusion running.
After getting all my files installed and setting my IDE I went on the web and was looking through various tutorials. Here is one I liked but I’m sure there are many others. As soon as the NDA is lifted or defined about what can and can’t be shared I will look at buying one of the programming books.

Do you dream in code?

Imagine for a moment you are about to go to sleep. You’ve just been reading one of your favorite technical literary works and now it’s time to go to bed. After finally falling asleep you don’t have your normal dreams of family, beaches, and crazy stuff. Instead you dream of computer code. Pages and pages of it. And you’re working on it. And it actually looks pretty good. But the alarm clock goes off and just like pulling the plug everything goes black before going to light.
Or does this only happen to someone like me?

Stumping dummy

While working on a problem at work today I had a thought…about my younger days working as a web developer in a university. The weather was hot and approaching unbearable just like today. Unlike this office, the state university office had air-conditioning. So one day we were having a go at each other after lunch. I was a real bookworm so I always had an answer for just about everything computer related. And my liberal arts degree handled just about everything else. One of my colleagues decided they were going to test my SAT test taking skills and asked me some random question from one of the hundreds of biology books stored in the office. By this point my last biology class was freshmen highschool years (about 8 years). While I can’t remember the question, nor the answer, now I do remember the look on everyone’s face when I answered correctly.
In some ways I astonish myself because I’ve acquired a lot of things in the head over the years. Most of this is outside of my core competances. But you never know when someone will call on you to see if you know something completely outside your field. I’m a software developer and I rarely delve into the Active Directory stuff these days. I’ve had that brief spark of clarity where a network problem stumps someone else and I’m able to answer the question.

The problem with “It just works!”

Software development is still an industry that is still in it’s infancy. I know there are a lot of computer scientists out there. I know a few of them. These guys and girls are just as inquisitive as I am about working with computers and how they work. And sometimes, like me, they encounter a phenomenon that fails to reproduce itself. Or if it reproduces itself it mysteriously vanishes back into the ether.
At our company we ship regularly. But our clients are quite slow at the uptake when it comes to deployment. I recently had a client with 2 previous versions of software in the testing pipeline. That means when they encounter a bug we fixed in a later version they can only complain about it. It sort of makes us look bad because the end user thinks we are unresponsive and slow.
Recently, after an update we encountered a bug that defied every method we tried to fix it with. What made it worse is the section of code where it was occuring hadn’t been touched in this release so the bug couldn’t have come from there. And it was only coming from a few servers. So we had no idea why it would occur on one server and not another. After much trial and error we discovered there might be a bug not in our software but in the operating system. After getting all the clients to run a serious of patches that may not work. We were in luck. The debriefing afterward was more like “blame it on Microsoft… they probably introduced a bug and then corrected it in a system update”. Yeah, we blamed it on someone else.

Developer library

After trying to find a solution to a problem we were having with a neighbor, my wife moved my office into my son’s room and moved our son into the office/dining room. She also took the opportunity to clean up my desk, through away old papers, and dig up my books. I was happy to find the books I’ve been reading or finished reading. Mom recently sent me a care package with a few of my favorite books. I’ve taken the time to rebuild my library in my new office.
Here are a few of the books I’ve kept in my collection through the years:

  • Flash MX 2004 from the source.
  • Code Complete
  • Head first (or head start?) Design Patterns
  • JavaScript (O’Reilly)
  • Foundations in .NET C# edition MCAD book
  • ASP.NET Web development MCAD book
  • ADO.NET
  • PHP professional application development
  • Various DVDs videos in Flash
  • Various DVDs videos in Final Cut Pro Express

I’ve also got a few language books: Chinese and French language books. I’m really looking forward to learning French and some conversational mandarin.
I’ve found the Code Complete to be the best and longest book I’ve read in a long time. And there is a lot of useful information to help improve my code as a developer. Hopefully, one day, I’ll write my own book on some programming language that I really like. Maybe in a few years. Maybe when life at home gets easier.

OpenVPN on TAP

I’ve been using OpenVPN at work for a while now. One of the things I was curious about was the difference between TAP and TUN connections. By default OpenVPN uses the TUN. The release notes said something about compatibility in other operating systems and I saw a nice split of Windows and PC users so I decided compatibility was the more important. But the cost was the performance of the system. I’m not sure on the network level what the difference between a TAP and TUN connection. I know a tun uses single port. and a type creates a virtual device that uses a tunnel. But I decided to switch our internal VPN to TAP.
What a difference that makes. Using TAP we can browse other computers on the VPN as if they were on a localhost. And the speed of file copies went up a little bit. Browsing the server improved dramatically.
So if you are using OpenVPN and are on a primarily windows environment I would suggest using TAP in the server and client configs. The steps are

  1. open client config.ovpn in your favorite text editor.
  2. change dev tun to dev tap
  3. open the server config.ovpn in your favorite text editor
  4. change dev tun to dev tap
  5. change the server IP and subnet to: server 10.8.0.0 255.255.255.0 or whatever your iprange will be
  6. restart all server and client openvpn daemons
  7. breathe the fresh air of having local network speed on boxes far away

Cheers

Fedora Core 8…A week later

The great thing about using Linux is it’s free and the rules are really basic. The bad thing about Linux is it’s free and getting support can be a bit of a nightmare. It’s been a week since I successfully installed Fedora Core 8. After using a variety of help guides I can say that it truly rocks. Whether or not I can use it productively is another question. You see I’m a .Net developer. which means I’m closely bound to the Windows side of doing things. On my ancient and underpowered laptop getting Windows to run on VMWare can be a virtual nightmare. While it’s great as a server the GUI is pretty sluggish. But since connectivity is the safe word I can get around that by RDPing into a real windows machine.
I am a pragmatic and polyglot so I did install the Java IDE and Netbeans. Now seems like the perfect time to learn Java programming and compare it to C#.