pwnage just came out and managed to solve the codesign and program being "killed" issue. will update soon.
pwnage just came out and managed to solve the codesign and program being "killed" issue. will update soon.
yup just figured this out too, but would be amazing if you could add the CODESIGN_ALLOCATE env setting and ldid -S to a build step in the template. Can't wait!
I am stuck on this too but I can't debug because NSLog does not work inside applicationDidFinishLaunching. It is dieing somewhere in that method but I dont know where. I applicationDidFinishLaunching is working though because I have used it in a basic app and it seems to do the stuff I have written.
edit: NSLogs go to a the system log and can be viewed with the organiser in xcode.
Last edited by zebrum; 07-28-2008 at 01:58 AM.
Here is the update of Xcode Template for pwned firmware 2.0 and open toolchain using the Final SDK.
(1) If you have not installed the open toolchain header, please refer to the first post (point 2) to install it
http://www.hackint0sh.org/forum/showthread.php?t=38389
(2) Installed the Apple's Final iPhone SDK (build 9M2199a) in Mac and with pwned iPhone OS 2.0
(3) Follow this guide to create a self-signed certificate http://developer.apple.com/documenta...section_2.html
If you are already registered iPhone Developer, please create the certificate name to something else
e.g. "iPhone Pwned Developer"
(4) You should follow this to patch the SpringBoard and MobileInstallation in pwned iPhone OS 2.0 firmware. I have tested this patch using iPhone 1st generation and working fine.
http://www.246tnt.com/iPhone/#xcode
But I have made some modifications to the procedure as below, as the self created certificate "iPhone Developer" will ambiguously match with your existing certificate, if you are already iPhone Registered Developer. So I change the certificate name to "iPhone Pwned Developer" for the following procedure and the Xcode template in point 4
If you have already patched the SpringBoard and MobileInstallation, you don't need to do this again.
P.S. The springboard patch can be skipped, see here
http://www.hackint0sh.org/forum/showthread.php?t=47629
(4) Download this template and use this command to install in your mac. The installation will go to "Application Pwned" directory of the Project Template. This template already incorporated a shell script build to codesign the binary before installation to iPhone.Code:#/bin/sh #assume your iPhone IP is this, change this if it is not export IPHONE_IP=10.0.2.2 mkdir iphone_tmp cd iphone_tmp scp root@$IPHONE_IP:/System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation . scp root@$IPHONE_IP:/System/Library/CoreServices/SpringBoard.app/SpringBoard . cp MobileInstallation MobileInstallation.bak cp SpringBoard SpringBoard.bak curl -O http://www.246tNt.com/iPhone/iphone_binary_patch curl -O http://www.246tNt.com/iPhone/SpringBoard.xcent chmod +x ./iphone_binary_patch ./iphone_binary_patch export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate codesign -s "iPhone Pwned Developer" -f MobileInstallation codesign -s "iPhone Pwned Developer" --entitlements SpringBoard.xcent -f SpringBoard scp MobileInstallation root@$IPHONE_IP:/System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation scp SpringBoard root@$IPHONE_IP:/System/Library/CoreServices/SpringBoard.app/SpringBoard
MD5 (ToolChainTemplate_v3.zip) = fd88fe59395ec530d5fc793cc9c85a1dCode:curl http://cocoatouchdev.com/javacom/ToolChainTemplate_v3.zip > ToolChainTemplate_v3.zip unzip -o ToolChainTemplate_v3.zip -d "/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates"
There is currently only one template in this update
(5) This template supports "Build and Go" to "Device and Release" only, so you have to connect your iPhone to USB cable when "Build and Go". It also supports setting breakpoint and debug iPhone program in Xcode.
(6) If you rebuild the project using this template, please uninstall any previous build using the Xcode Organizer before "Build and Go" again. This will ensure that Xcode to regenerate the application map. If you uninstall the previous build by simply remove the application icon in iPhone, your subsequent "build and go" would fail.
If you forgot to uninstall the previous build, your second "Build and Go" would fail as well.
(7) The source code should be in the "Classes" directory and Resources file like png should be in the "Resources" directory of the Project.
(8) There is also a Makefile in the project template, so that you can run "make" then "make install" to the /Applications/ directory of iPhone. The Makefile will make use of the Mac OS X Intel binary of ldid (from Saurik) to sign the binary before ssh to iPhone. Please amend the IPHONE_IP in the Makefile to the ip address of your iPhone before "make install"
(9) If you want to uninstall the previous versions 1 or 2 of this Xcode Template (which was for SDK beta 3). You can do this by
Code:rm -fr "/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Open Tool Chain"
Last edited by javacom; 09-02-2008 at 05:36 AM. Reason: Add : The springboard patch can be skipped
If you want to test version 3 of this Xcode template in your pwned iPhone OS 2.0, you can try this sample toolchain HelloWorld.app
Code:/* HelloWorld.app main.m */ #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import "HelloWorld.h" int main(int argc, char *argv[]) { int returnCode; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // this is for old toolchain UIApplicationMain // returnCode = UIApplicationMain(argc, argv, [HelloWorld class]); // use this if you have updated the toolchain headers from http://code.google.com/p/iphone-dev/ after Aug 19, 2008 returnCode = UIApplicationMain(argc, argv, @"HelloWorld"), @"HelloWorld"); [pool release]; return returnCode; }
Code:/* HelloWorld.app HelloWorld.h */ #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import <UIKit/UIApplication.h> #import <UIKit/UIPushButton.h> #import <UIKit/UITableCell.h> #import <UIKit/UIImageAndTextTableCell.h> @interface HelloWorld : UIApplication { UIImageAndTextTableCell *pbCell; UITableCell *buttonCell; UIAlertSheet *alert; UIView *mainView; } - (void) alertEvent:(NSString*)message; @end
Code:/* HelloWorld.app HelloWorld.m */ #import <CoreFoundation/CoreFoundation.h> #import <Foundation/Foundation.h> #import <UIKit/CDStructures.h> #import <UIKit/UIPushButton.h> #import <UIKit/UIThreePartButton.h> #import <UIKit/UINavigationBar.h> #import <UIKit/UIWindow.h> #import <UIKit/UIView-Hierarchy.h> #import <UIKit/UIHardware.h> #import <UIKit/UITable.h> #import <UIKit/UITableCell.h> #import <UIKit/UITableColumn.h> #import "HelloWorld.h" @implementation HelloWorld - (int) numberOfRowsInTable: (UITable *)table { return 2; } - (UITableCell *) table: (UITable *)table cellForRow: (int)row column: (int)col { return row ? buttonCell : pbCell; } - (UITableCell *) table: (UITable *)table cellForRow: (int)row column: (int)col reusing: (BOOL) reusing { return pbCell; } - (void) applicationDidFinishLaunching: (id) unused { UIWindow *window; window = [[UIWindow alloc] initWithContentRect: [UIHardware fullScreenApplicationContentRect]]; pbCell = [[UIImageAndTextTableCell alloc] init]; [pbCell setTitle: [NSString stringWithFormat:@"Hello World!"]]; UIPushButton *button = [[UIThreePartButton alloc] initWithTitle:@"Touch Me"]; buttonCell = [[UITableCell alloc] init]; [buttonCell addSubview: button]; [button sizeToFit]; UITable *table = [[UITable alloc] initWithFrame: CGRectMake(0.0f, 48.0f, 320.0f, 480.0f - 16.0f - 32.0f)]; UITableColumn *col = [[UITableColumn alloc] initWithTitle: @"HelloApp" identifier: @"hello" width: 320.0f]; [window orderFront: self]; [window makeKey:self]; [window _setHidden: NO]; [table addTableColumn: col]; [table setDataSource: self]; [table setDelegate: self]; [table reloadData]; UINavigationBar *nav = [[UINavigationBar alloc] initWithFrame: CGRectMake( 0.0f, 0.0f, 320.0f, 48.0f)]; [nav showButtonsWithLeftTitle: @"Foo" rightTitle: @"Bar" leftBack: NO]; [nav setDelegate: self]; [nav setBarStyle: 0]; struct CGRect rect = [UIHardware fullScreenApplicationContentRect]; rect.origin.x = rect.origin.y = 0.0f; mainView = [[UIView alloc] initWithFrame: rect]; [mainView addSubview: nav]; [mainView addSubview: table]; [window setContentView: mainView]; } - (void) navigationBar: (UINavigationBar *)navBar buttonClicked: (int)button { switch (button) { case 0: //Right button [self alertEvent: @"Hello Bar"]; break; case 1: //Left button [self alertEvent: @"Hello Foo"]; break; } } - (void) alertEvent:(NSString*)message { if (message == nil) { alert = [[UIAlertSheet alloc] initWithTitle: @"Hello" buttons: [NSArray arrayWithObjects: @"Yes", @"No", nil] defaultButtonIndex: 1 delegate: self context: nil]; [alert setBodyText: @"Hi there?"]; } else { alert = [[UIAlertSheet alloc] initWithTitle: @"Hello" buttons: [NSArray arrayWithObjects: @"OK", nil] defaultButtonIndex: 1 delegate: self context: nil]; [alert setBodyText: message]; } [alert popupAlertAnimated:YES]; } - (void)alertSheet:(UIAlertSheet*)sheet buttonClicked:(int)button { [self setApplicationBadge:@"hello"]; /* if (button == 1 && [sheet buttonCount] == 2) { UIAlertSheet *helloSheet = [ [ UIAlertSheet alloc ] initWithFrame: CGRectMake(0, 240, 320, 240) ]; [ helloSheet setTitle:@"" ]; [ helloSheet setBodyText: [ NSString stringWithFormat: @"Hello to iPhone" ] ]; [ helloSheet addButtonWithTitle:@"OK" ]; [ helloSheet setDelegate: self ]; [ helloSheet presentSheetInView: mainView ]; } */ [alert dismiss]; [alert release]; } - (void)dealloc { [super dealloc]; } @end
Last edited by javacom; 09-11-2008 at 09:39 AM. Reason: update for new UIApplicationMain
Please can you tell us how to sign with our own dev certificate?
edit: I'll answer my own question...you can skip the self signed cert and patching stuff above by using your dev cert in the normal way e.g. in project properties change the name to iPhone Developer: Your Name. And then just expand Targets in the Xcode groups&files tree view, expand again and delete the last step which is code sign.
Once you want to relase your app in Cydia you will need to add the ldid step back in though.
Last edited by zebrum; 08-01-2008 at 12:39 AM.
if I create a new project, and just add
#import <UIKit/UIDevice.h>
it will give me the error,
error: syntax error before 'NSInteger'
Line Location UIDevice.h:28
any idea what's the reason?
Is it possible to add link flags (-lsqlite3) in template/project ?
Thanks,
Rikk
Do i have to register for the Developer program for this?
i get a "No provisioned iPhone OS device is connected", when i try Build&Go.
Thanks.
Bookmarks