Wednesday, October 13, 2010

Flash Builder 4 + iphone packager

1) create actionscript project
2) code AS
3) compile > test > SWF
3a) Create application.xml (refer to below)
4) PFI + .mobileprovision + .p12 + all necessary files > IPA
eg.:
pfi.bat -package -target ipa-test -provisioning-profile "MyApp.mobileprovision" -storetype pkcs12 -keystore "iphone_dev.p12" HelloWorld.ipa application.xml MyApp.swf
Default.png icons [and other files or folders]
5) install .mobileprovision in itunes if not done so. File > Add to library. sync iphone
6) add IPA to itunes. sync.

application.xml:
<?xml version="1.0" encoding="utf-8"?>
<application xmlns="http://ns.adobe.com/air/application/2.0">
<id>com.myDomain.MyApp</id>
<filename>HelloWorld</filename>
<name>HelloWorld</name>
<version>1.0</version>
<initialWindow>
<content>MyApp.swf</content>
<fullScreen>true</fullScreen>
<autoOrients>false</autoOrients>
<aspectRatio>portrait</aspectRatio>
<renderMode>cpu</renderMode>
</initialWindow>
<icon>
<image512x512>icons/icon512.png</image512x512>
<image57x57>icons/icon57.png</image57x57>
<image29x29>icons/icon29.png</image29x29>
</icon>
</application>

Tuesday, October 05, 2010

iPhone development: Objective C

hmm.. property has to be defined after interface

eg.:

@interface MyViewController : UIViewController {
UITextField *textField;
UILabel *label;
NSString *string;
}
@property (nonatomic, retain) IBOutlet UITextField *textField;
@property (nonatomic, retain) IBOutlet UILabel *label;
@property (nonatomic, copy) NSString *string;

- (IBAction) changeGreeting: (id) sender;


NOT

@property (nonatomic, retain) IBOutlet UITextField *textField;
@property (nonatomic, retain) IBOutlet UILabel *label;
@property (nonatomic, copy) NSString *string;

- (IBAction) changeGreeting: (id) sender;
@interface MyViewController : UIViewController {
UITextField *textField;
UILabel *label;
NSString *string;
}


to use these in the .m files
must use @synthesize
eg.:
@synthesize textField;
@synthesize label;
@synthesize string;