Results 1 to 1 of 1

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.

Thread: Saurik on porting 1.x apps to 2.x

  1. #1
    Former Owner / Founder of ModMyi Kyle Matthews's Avatar
    Join Date
    May 2007
    Tampa, Florida, United States
    Thanked 4,905 Times in 1,247 Posts

    Default Saurik on porting 1.x apps to 2.x
    NOTE: If you've ported your app to work on 2.0 Jailbroken devices, please let us know by submitting it for us to host on our 2.0 compliant Cydia repo. This will ensure you get your app out to as many jailbreakers as possible. For help, ask here or in our IRC.

    For you developers of Jailbroken applications, Saurik (creator of Cydia) has a great, informative write-up on porting 1.x apps to 2.x. This can be found by opening Cydia on your iPhone and clicking the Porting Apps from 1.x to 2.x link, but I thought you guys might also find it useful here.

    LayerKit -> CoreAnimation

    Pretty much everything in LAyerKit has been moved to QuartzCore. LayerKit was really just the older name of CoreAnimation, and now most anything that was LK* maps to something similar in CA*. The names, however, aren't always the same. For example, LKCurrentTime has become CACurrentMediaTime.

    UIFont/UIColor vs. CG/GS*Ref

    Fonts and colors are handled by GraphicsServices and CoreGraphics, respectively. This used to be exposed directly in UIKit for 1.x (setColor: for example would normally take a CGColorRef). The new UIKit, however, has wrapped these primitives in Objective-C guises. Converting back/forth between these types is typically easy.

    Using PrivateFrameworks

    In order to keep application developers from using backend APIs of other applications (i.e., APIs that are going to change often and lead to unstable, brittle applications), Apple has moved most of their internal-use-only libraries into /System/Library/PrivateFrameworks, which is not normally on the link path. To add this back you need to pass this directory to gcc with -F.

    Using Undocumented UIKit

    The #1 thing to understand about UIKit is that Apple mostly didn't change it. For some unknown backwards compatibility reason they left in most of the 1.x classes, which means most of the code for 1.x can be compiled with only minor naming differences for the new platform. (Thanks goes to Jonathan Zdziarski (NerveGas) for figuring this out.)

    UIAlertSheet - UIActionSheet
    UIButtonBar - UIToolbar
    UISliderControl - UIOldSliderControl
    UISwitchControl - _UISwitchSlider
    UIWebView - UIWebDocumentView

    Alert/Action Sheet Dismissal

    Pretty much all usages of dialog boxes involved dismissing the dialog box during a buttonClicked: event. Apple has renamed this to didDismissWithButtonIndex: and does the call to -(vod)dismiss.

    Double vs. Single Precision

    A few places in the original UIKit libraries Apple was using double's, even though pretty much everywhere they use floats. These places have been changed. One such example is [UIProgressBar setProgressfloat)].

    Automatic Keyboard Support

    Apple has decided that manually having to manage the keyboards that go with text input fields is stupid, and I must say I agree with them. Unfortunately, this means that code used to manually bring up keyboards is now dangerously out of date: you end up with two keyboards, only one of which normally works.

    CoreGraphics vs. ImageIO

    Most programs that need to draw things to the screen do not need to have complex data input/output from said graphics buffers. All of this file format and color munging code was probably taking up too much memory, so it got forked out to a different library: ImageIO. Examples: CGImageDestination/Source.


    Previous, UIApplicationMain() was passed the metaclass object of a type that derived from the class UIApplicationMain, which it would then instantiated. Now it optionally takes the names of two separate classes that take on different aspects of UIApplication's functionality. If you pass the name of your old class for both these arguments you will get seemingly identical behavior.

    mprotect(), NX, and max_prot

    While this information doesn't apply to applications developed for JailBroken devices, it is still useful to understand that Apple has started taking measures to protect against arbitrary code execution. In addition to code signing, pages that were once writable can never be marked executable, which means no JIT compilers or dynamic trampolines (in other words, bye bye performance). This particular issue has been patched out of the kernel by Pwnage.
    Also, here's his link on the new toolchain for 2.0.

    PLEASE keep this thread to the topic at hand. If you wish to discuss the merits of Cydia, if devs will port apps, etc, do so in Native Apps discussion.
    Last edited by Kyle Matthews; 2008-07-21 at 02:17 AM. Reason: Automerged Doublepost

    ↑ ↑ ↓ ↓ ← → ← → B A [select] [start] Kyle Matthews

  2. The Following 5 Users Say Thank You to Kyle Matthews For This Useful Post:

    Bloaty (2008-07-22), Dashiznit (2008-08-18), lighter (2008-07-29), thakurupted (2008-07-26), tntmorgan (2008-07-20)

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts