Archive for March, 2010

iPhone simulator/Titanium Developer crash on 1.1.1+

Thursday, March 25th, 2010

OK, tonight we finally just figured out what has been causing Titanium Developer to crash. In fact, it was related to more 3.2 SDK related problems on our end. We have been able to rebuild the iphonesim binary using the correct parameters to allow it to run on 32-bit, 64-bit and on both 10.5 and 10.6 — all in one universal binary.

If you are experiencing this problem, please download the patched iphonesim binary from here until we do a full update. You should save this file into the directory /Library/Application Support/Titanium/mobilesdk/osx/1.1.2/iphone. You do not need to restart Titanium Developer.

Note, it appears this issue is only related to 10.5. If you’re on 10.6, you should not have experienced this issue. Just as a future reference, in order to move to iPhone 3.2 SDK (and iPad), you’ll need to be prepared to move to Snow Leopard. It appears Apple no longer supports 10.5 with the move to 3.2.

Sorry for all of the issues around this.

The Apple Rejection Economy and Therapy

Thursday, March 25th, 2010

There is one group that must be benefit from the Apple Rejection economy and that is therapists. I can tell you that being on the other end of Apple rejection process causes great angst, concern and stress. When dealing with stress, you attempt to understand it and face it head on as a way of containing it. In some ways, stress is the feeling of being out of control and typically mechanisms which help you gain control are ways in which you can control stress.

We have recently had a few apps built on Titanium get rejected by Apple. While App rejections are an everyday occurrence in the Apple Rejection economy, we’ve been under a lot of pressure in the past week because of two particularly troublesome rejections — the use of Unicode and the use of the C sprintf function. But let me focus on the most worrisome to us, the use of sprintf. Yep, that’s right. Good ‘ole sprintf. Before I explain, let me digress into how Titanium works as a primer.

Titanium takes your Javascript Titanium API code usage and builds what we call an inverse symbol dependency matrix. Simply put it allows us to resolve all the APIs being used into a set of native symbols (slightly different between platforms, but in iPhone this is a object file). These symbols boil down to compile code that only matches the code your application needs and only those dependencies that you’re using in your application. Once we do this, we generate a bunch of Objective-C code from your code, take those symbols and then shove them into GCC to have him produce the final native application — as if you could have hand written the Objective-C code yourself… But highly optimized. Got it?

So, we’ve had a generic piece of code – and I’ll paste the exact line below – in Titanium for almost 8 months now. Unchanged.

Yesterday afternoon, Apple notified us (through someone submitting an app) that the following two APIs were private and could not be used:


__strcpy_chk
__sprintf_chk

Hrm. Obvious that it’s related to sprintf and strcpy. Both built-in C APIs as part of the standard language. OK, fair enough but I wasn’t aware of us using that code anywhere in our code and certainly not in any third-party code we include. A quick grep of our source code didn’t reveal anything obvious. My first step was simply comment out all references of sprintf in our code – a total of about 10 locations. On rebuild, I verified that the symbol was no longer present with a simple nm -a command against the compile application. WTF? OK, fine. I uncommented the first usage of sprintf and recompiled. Symbols not present. Huh? OK, i’m just not doing something right. Let me try another… After the 6th uncomment, I hit the mark. The following line of code causes GCC to generate 2 the “private APIs”.

sprintf(temp, "%02X, a);

Yes, folks, that’s right. What seems to be different between this sprintf and the others are the usage of the X (hex) format specifier and the precision (02). It seems by looking at Apple’s own Darwin Source Code for this function that this piece of code (contained in Libc, BTW) simply is a bounds safety check. Also, let me reiterate, GCC itself generated the use of this symbol, not Titanium.

My therapist tells me to take a deep breath, relax, visualize the problem being resolved.

Wait! I’m not writing that code, they are. Hrm…

OK, so I’m going to give Apple the benefit of the doubt because I’m an Apple n00b and I really believe that they have a pretty tough job and that they’re trying to do their best to keep out bad and harmful code from the sea of thousands of submissions per week they’re receiving. I’m also assuming that this latest set is probably related to upgrades in their scanners related to the impending iPad release or it’s related to our usage of the latest 3.2 SDK. They’re simply just a little overzealous on trying to separate the wheat from the chaff. Unfortunately, we (and more importantly, you) are a little bit caught in the cross hairs. And, I apologize.

So, here’s what we’re trying to do to at least do our part in helping make this a little less stressful for you.

1/ We’ve opened a Radar issue with Apple (#7793724) on this specific issue to at least see if they can fix this specific issue.

2/ We’ve resolved the problem by simply not using sprintf in this case. We’ll likely remove all usages of sprintf in favor of the usage of NSString’s built-in format method just to be overly cautious.

3/ We’ve setup a new email alias (appsupport@appcelerator.com) for you to notify us as soon as you see anything like this or any other rejection in the future. Please email us ASAP with your rejection information from Apple so we can help understand the issue. This email is available to everyone – regardless of if you’re a community, premium or otherwise. We take these submissions seriously and we want to help you resolve these issues as fast as possible. This alias will go straight into my email as well as Nolan Wright (our beloved CTO and co-founder) and several others. If you’re a premium customer, you can also open a high-priority ticket, too.

While we take every attempt humanly possible to follow Apple’s Developer guidelines, issues like these are part of the Apple Rejection economy. We know it will get better as Apple continues to improve their process, their communication level and their speed around app submissions. In the meantime, we’re committed to helping you get through this process as painless as practically possible under the circumstances.

Titanium Mobile 1.1.2

Wednesday, March 24th, 2010

OK, within hours of pushing 1.1.1 we found another critical fix. We would normally not ever do 2 quick pushes this close together but felt like we would err on the better side and push an update.

Titanium Mobile 1.1.1 maintenance release

Wednesday, March 24th, 2010

Given we had a number of critical issues reported in the 1.1 final release we decided tonight to push a 1.1.1 maintenance release to everyone. Hopefully this will fix a number of the reported issues related to the iphone simulator on Leopard and on older versions of the iPhone SDK. In our testing, we failed to realize that our own internal upgrades to 3.2 caused Apple to by default build the latest simulator only for 64-bit CPU architecture types. For 1.1.1 and going forward, we are building the simulator against both 32-bit and 64-bit CPU architectures and releasing a universal binary.

We also fixed a number of issues related to XML and DOM that were uncovered as well as a few other issues. You can see all the fixes in our issue tracking system.

Introducing Titanium Mobile 1.1

Tuesday, March 23rd, 2010

We have just pushed Titanium Mobile 1.1. You should be getting automated update notifications inside Titanium Developer if you have not already.

So here is a summary of what’s included. You can see all the resolved issues in our Issue Tracking System. Please review the specific items around the release and known issues.

Table View Speed Improvements

We have made more table view rendering improvements when dealing with remote images – especially images that are required to be scaled to size.

Significant Launch Speed Improvements in Simulator

We have made significant improvements in the compiler when launching in the simulator. Essentially, when running in simulator mode we now will do a full compile once with all dependencies inside the compiled application but we’ll now not pre-compile your source code. Instead, we’ll simply run in interpreted mode and load resources directory from your application Resource folder. On subsequent launches, we can now simply launch the simulator. This means you can develop-run-debug in a much more rapid cycle. When you run on device or package for distribution, we still do a full rebuild with dependency analysis.

iPhone XML/DOM Fixes

We made a number of fixes in the iPhone DOM implementation. Thanks to Mark Poston for submitting numerous test cases that allowed us to narrow down the fixes quickly.

iPhone Picker

We have expanded the Picker API to now support custom row painting (by using views), multicolumn support and now we support Date, Time, DateTime and count down picker types.

Map Views

We now support the ability to add multiple annotations in one call in MapView (iPhone only at the moment). This is a performance improvement patch we received from Chris Erway. (Thanks Chris!) This performance improvement is really only useful for apps that use a large number of annotations on the map and provides a nice speed boost.

Bonjour and Sockets Support

By popular request, Steve Tramer worked on adding Bonjour and TCP Socket support to iPhone and submitted his work to Titanium. We have brought this work in and it’s now available. We hope to bring Android up to have the same support as well as provide more enhanced networking capabilities in a near future release.

iPad support (Premium Subscribers Only)

With this release, we have pushed initial iPad project support. While you can run your apps today on iPad with Titanium, this provides native iPad application support and new iPad project and simulator support. If you’re a premium subscriber, we’ve sent you a link in email to how to access the update. If you’re not a premium subscriber yet, that’s OK. We’ll have support out very soon for everyone. We wanted to give our premium subscription customers the chance to play with it a little bit before we make it available to everyone. However, I’ll make this offer to you if you’re not yet a premium subscriber. If you’re building an iPad app today and want need access, email me.

iPhone 3.2 Beta 5 support

We now build Titanium against iPhone SDK 3.2 Beta 5.

Numerous Android Fixes and Improvements

We have made a lot of fixes and improvements on Android. The Android team has been working very hard with Android and all the various devices, operating system versions and firmware.

What’s next?

We’re planning on releasing 1.2 on April 5th. 1.2 will continue to add additional iPad UI support and fix various prioritized issues reported by premium subscribers and critical issues reported by the community.