Transcript
Page 1: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

iOS Basic Development

User Selection Design

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 2: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Social Share

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 3: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

UIActionSheet

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 4: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

- (IBAction)shareSocial:(id)sender { UIActionSheet *action = [[UIActionSheet alloc]initWithTitle:@"Social Network" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Facebook",@"Twitter", @"Instagram",@"Email", nil]; [action showInView:self.view];

}

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{ if(buttonIndex == 0){ [self directShareFacebook:nil]; } if(buttonIndex == 1){ [self directShareTwitter:nil]; } if(buttonIndex == 2){ [self directShareInstagram:nil]; } if(buttonIndex == 3){ [self directSendMail:nil]; }}

UIActionSheet

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 5: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Social Framework

Facebook

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 6: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

- (IBAction)directShareFacebook:(id)sender {

if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { SLComposeViewController *composeVC = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; [composeVC setInitialText:self.myTextView.text]; UIImage *image = self.myImageView.image; [composeVC addImage:image]; NSURL *url = [NSURL URLWithString:@"http://www.ibluecode.com"]; [composeVC addURL:url]; [self presentViewController:composeVC animated:YES completion:nil]; }}

SLComposeViewController : Facebook

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 7: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Social Framework

Twitter

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 8: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

- (IBAction)directShareTwitter:(id)sender {

if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) { SLComposeViewController *composeVC = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter]; [composeVC setInitialText:self.myTextView.text]; UIImage *image = self.myImageView.image; [composeVC addImage:image]; NSURL *url = [NSURL URLWithString:@"http://www.ibluecode.com"]; [composeVC addURL:url]; [self presentViewController:composeVC animated:YES completion:nil]; }}

SLComposeViewController : Twitter

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 9: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

UIDocumentInteractionController

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 10: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

- (IBAction)openDocumentAction:(id)sender {

NSURL *url = [[NSBundle mainBundle] URLForResource:@"mac_pro" withExtension:@"jpg"]; self.docController = [UIDocumentInteractionController interactionControllerWithURL:url]; self.docController.delegate = self ; BOOL isValid = [[UIApplication sharedApplication] canOpenURL:url]; NSLog(@"uti: %@", [self.docController UTI]); if(isValid){ [self.docController presentOptionsMenuFromRect:self.view.frame inView:self.view animated:YES]; }

}

UIDocumentInteractionController : All

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 11: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

- (IBAction)directShareInstagram:(id)sender { NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"]; if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) { NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"Image.igo"]; NSData *imageData = UIImagePNGRepresentation(self.myImageView.image); [imageData writeToFile:savedImagePath atomically:YES]; NSURL *imageUrl = [NSURL fileURLWithPath:savedImagePath]; NSLog(@"%@",imageUrl); UIDocumentInteractionController *docController = [UIDocumentInteractionController new]; docController.delegate = self; docController.UTI = @"com.instagram.exclusivegram"; docController.URL = imageUrl; [docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];

}else{

[self showAlertView:@"Please install Instagram before share."]; }

}

UIDocumentInteractionController : Instagram

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 12: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

UIAlertView

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 13: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

-(void)showAlertView:(NSString*)title{ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:@"" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alert show];}

UIAlertView

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 14: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

MFMailComposeViewController

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 15: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

- (IBAction)directSendMail:(id)sender {

if ([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *mailVC = [[MFMailComposeViewController alloc] init]; mailVC.mailComposeDelegate = self; [mailVC setSubject:@"Subject"]; NSArray *toRecipients = [NSArray arrayWithObjects: @"[email protected]", @"[email protected]", nil];

[mailVC setToRecipients:toRecipients]; UIImage *myImage = self.myImageView.image ; NSData *imageData = UIImagePNGRepresentation(myImage); [mailVC addAttachmentData:imageData mimeType:@"image/png" fileName:@"attachment"]; NSString *emailBody = self.myTextView.text; [mailVC setMessageBody:emailBody isHTML:NO]; //iOS 5 //[self presentModalViewController:mailer animated:YES]; //iOS 6 [self presentViewController:mailVC animated:YES completion:nil]; }}

MFMailComposeViewController

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 16: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

UIPickerView

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 17: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Class : UIPickerView

Framework : UIKit

Sample Code : UICatalog

Init : initWithFrame : (CGRect) or Interface Builder

Datasource : – numberOfComponentsInPickerView: – pickerView:numberOfRowsInComponent:

Delegate : – pickerView:titleForRow:forComponent: – pickerView:viewForRow:forComponent:reusingView: – pickerView:didSelectRow:inComponent:

UIPickerView

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 18: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

āļāļēāļĢāđ€āļĢāļĒāļāđƒāļŠāļ‡āļēāļ™

1. Init UIPickerView2. bind Datasouce / Delegate3. āļāļēāļŦāļ™āļ”āļ„āļ­āļĨāļĄāļ™ numberOfComponentsInPickerView4. āļāļēāļŦāļ™āļ”āļˆāļēāļ™āļ§āļ™āđāļ–āļ§ pickerView:numberOfRowsInComponent:5. āļāļēāļŦāļ™āļ”āļāļēāļĢāđāļŠāļ”āļ‡āļ„āļēāđ€āļ›āļ™ Text āļŦāļĢāļ­ View āđ„āļ” pickerView:titleForRow:forComponent:

pickerView:viewForRow:forComponent:reusingView:6. āđƒāļŠ Delegate āđ€āļĄāļ­āđ€āļĨāļ­āļāļ‚āļ­āļĄāļĨāđ€āļŠāļĢāļˆ pickerView:didSelectRow:inComponent

UIPickerView

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 19: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

1. Init UIPickerView (.h)

IBOutlet UIPickerView *myPV ;

2. bind Datasouce / Delegate (.m)

[myPV setDataSource:self]; [myPV setDelegate:self]; [myPV selectRow:0 inComponent:0 animated:NO]; [myPV selectRow:0 inComponent:1 animated:NO]; [myPV selectRow:0 inComponent:2 animated:NO];

UIPickerView

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 20: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

3. āļāļēāļŦāļ™āļ”āļ„āļ­āļĨāļĄāļ™ (.m)

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;{ return 3 ;}

4. āļāļēāļŦāļ™āļ”āļˆāļēāļ™āļ§āļ™āđāļ–āļ§ (.m)

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;{ if(component == 1){

return 20 ;}if(component == 0){return 30 ;}

return 10 ;}

UIPickerView

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 21: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

5. āļāļēāļŦāļ™āļ”āļāļēāļĢāđāļŠāļ”āļ‡āļ„āļēāđ€āļ›āļ™ Text āļŦāļĢāļ­ View āđ„āļ” (.m)

#pragma āđāļŠāļ”āļ‡āļ„āļēāđ€āļ›āļ™ Text

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;{ NSMutableArray *arrayNo1 = [[NSMutableArray alloc] init]; [arrayNo1 addObject:@"0"]; [arrayNo1 addObject:@"1"]; [arrayNo1 addObject:@"2"]; [arrayNo1 addObject:@"3"]; [arrayNo1 addObject:@"4"]; [arrayNo1 addObject:@"5"]; [arrayNo1 addObject:@"6"]; [arrayNo1 addObject:@"7"]; [arrayNo1 addObject:@"8"]; [arrayNo1 addObject:@"9"];

return [arrayNo1 objectAtIndex:row];}

UIPickerView

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 22: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

5. āļāļēāļŦāļ™āļ”āļāļēāļĢāđāļŠāļ”āļ‡āļ„āļēāđ€āļ›āļ™ Text āļŦāļĢāļ­ View āđ„āļ” (.m)

#pragma āđāļŠāļ”āļ‡āļ„āļēāđ€āļ›āļ™āļĢāļ›āļ āļēāļž

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{

NSString *imageName = [NSString stringWithFormat:@"%d.png",row];

UIImageView *bgImageView = [[UIImageView alloc]initWithImage: [UIImage imageNamed:imageName]];

[bgImageView setFrame:CGRectMake(0, 0, 50, 50)];

[bgImageView setContentMode:UIViewContentModeScaleAspectFit];

return bgImageView;

}

UIPickerView

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 23: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

6. āđƒāļŠ Delegate āđ€āļĄāļ­āđ€āļĨāļ­āļāļ‚āļ­āļĄāļĨāđ€āļŠāļĢāļˆ

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{ if(component == 0){ inputCol1 = [arrayNo1 objectAtIndex:row]; } else if(component == 1){ inputCol2 = [arrayNo2 objectAtIndex:row]; } else if(component == 2){ inputCol3 = [arrayNo3 objectAtIndex:row]; }

}

UIPickerView

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 24: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111

Top Secret

Saturday, June 15, 13

Page 25: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Workshop : Top Secret

Task : āļŠāļĢāļēāļ‡āļŦāļ™āļēāļˆāļ­ Login Password āđ‚āļ”āļĒ User āļ•āļ­āļ‡āļ—āļēāļāļēāļĢāđ€āļĨāļ­āļ Password =246 āļˆāļēāļ UIPickerView āļˆāļēāļāļ™āļ™āļˆāļ‡āđ€āļ‚āļēāļŠāļŦāļ™āļēāļˆāļ­āļ•āļ­āđ„āļ› āļŠāļēāļĄāļēāļĢāļ– Reset āļ„āļēāđ„āļ”āļˆāļēāļāļ›āļĄ RESET BUTTON

Objective : āļ™āļāđ€āļĢāļĒāļ™āļĄāļ„āļ§āļēāļĄāđ€āļ‚āļēāđƒāļˆāđƒāļ™āđ€āļĢāļ­āļ‡ UIViewController User Interface āđāļĨāļ° IBOutlet Action-Target Datasouce Delegate

UIPickerView

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 26: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

iOS Basic Development

Submit App Store

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 27: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Course Outline

1. Introduction & Xcode

2. Objective-C & Frameworks

3. View & ViewController

4. View & ViewController (2)

5. Submit App Store

Course Outline

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 28: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Developing iOS Apps : App Store

Add New Application ( iTunes Connect )

Upload required icon and screenshots

Upload Application Binary ( IPA File )

Waiting for app review by apple ( 7 days - Few months)

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 29: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

āļŦāļĨāļ‡āļˆāļēāļāļ—āļ™āļāđ€āļĢāļĒāļ™āđ„āļ”āđ€āļĢāļĒāļ™āļĢāļāļēāļĢāļžāļ™āļāļēāļ™āļāļēāļĢāđ€āļ‚āļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄāļšāļ™ iPhone āđāļĨāļ°āļāļēāļĢāđƒāļŠ Tool āļ•āļēāļ‡ āđ† āđ„āļ›āđ€āļĢāļĒāļšāļĢāļ­āļĒāđāļĨāļ§

āļ™āļāđ€āļĢāļĒāļ™āļāļ—āļēāļāļēāļĢāđ€āļ‚āļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄāđ„āļ”āļ­āļĒāļēāļ‡āļĢāļēāļšāļĢāļ™ āļĢāļ°āļŦāļ§āļēāļ‡āļ—āđ€āļ‚āļĒāļ™ Code āļ™āļ™āļāđ„āļĄāļĄ Error āļ­āļ°āđ„āļĢ āļŠāļēāļĄāļēāļĢāļ– Compile āđāļĨāļ° Run Application āđ„āļ”āđ‚āļ”āļĒāđ„āļĄāļĄāļāļēāļĢ Crash āļ‚āļ­āļ‡āđ‚āļ›āļĢāđāļāļĢāļĄāđāļĨāļ°āļāļēāļĢāļ—āļēāļ‡āļēāļ™āļ•āļēāļ‡ āđ† āļ™āļ™āļĢāļ§āļ”āđ€āļĢāļ§āļ–āļāļ•āļ­āļ‡āļ•āļēāļĄāļ—āļ­āļ­āļāđāļšāļšāđ„āļ§āļ—āļāļ›āļĢāļ°āļāļēāļĢ.....

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 30: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

āļŦāļĨāļ‡āļˆāļēāļāļ—āļ™āļāđ€āļĢāļĒāļ™āđ„āļ”āđ€āļĢāļĒāļ™āļĢāļāļēāļĢāļžāļ™āļāļēāļ™āļāļēāļĢāđ€āļ‚āļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄāļšāļ™ iPhone āđāļĨāļ°āļāļēāļĢāđƒāļŠ Tool āļ•āļēāļ‡ āđ† āđ„āļ›āđ€āļĢāļĒāļšāļĢāļ­āļĒāđāļĨāļ§

āļ™āļāđ€āļĢāļĒāļ™āļāļ—āļēāļāļēāļĢāđ€āļ‚āļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄāđ„āļ”āļ­āļĒāļēāļ‡āļĢāļēāļšāļĢāļ™ āļĢāļ°āļŦāļ§āļēāļ‡āļ—āđ€āļ‚āļĒāļ™ Code āļ™āļ™āļāđ„āļĄāļĄ Error āļ­āļ°āđ„āļĢ āļŠāļēāļĄāļēāļĢāļ– Compile āđāļĨāļ° Run Application āđ„āļ”āđ‚āļ”āļĒāđ„āļĄāļĄāļāļēāļĢ Crash āļ‚āļ­āļ‡āđ‚āļ›āļĢāđāļāļĢāļĄāđāļĨāļ°āļāļēāļĢāļ—āļēāļ‡āļēāļ™āļ•āļēāļ‡ āđ† āļ™āļ™āļĢāļ§āļ”āđ€āļĢāļ§āļ–āļāļ•āļ­āļ‡āļ•āļēāļĄāļ—āļ­āļ­āļāđāļšāļšāđ„āļ§āļ—āļāļ›āļĢāļ°āļāļēāļĢ.....

āđƒāļŠāļŦāļĢāļ­āđ„āļĄ ?

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 31: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

āđ‚āļ”āļĒāļ›āļāļ•āđāļĨāļ§āļ‚āļ™āļ•āļ­āļ™āļāļēāļĢāđ€āļ‚āļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄ āļĢāļ°āļŦāļ§āļēāļ‡āļ— āļ—āļēāļāļēāļĢ Build & Run āļˆāļ°āđ€āļ›āļ™āđ€āļŠāļ™āļ™

1. Error ! (āđ„āļĄāļŠāļēāļĄāļēāļĢāļ– āļ—āļēāļāļēāļĢ Build āđ„āļ”)2. Warning ! (āđ„āļĄ Error āđāļ•āļĄāļāļēāļĢāđ€āļ•āļ­āļ™)3. Crash ! (Build āđ„āļ”āđāļ• Run āđ„āļĄāđ„āļ”)4. Wrong ! (Run āđ„āļ”āđāļ•āļ—āļēāļ‡āļēāļ™āļœāļ”)5. Slow ! (āļ—āļēāļ‡āļēāļ™āļ–āļāđāļ•āļŠāļē āđ„āļĄāļĨāļ™)6. Work ! (āļ—āļēāļ‡āļēāļ™āđ„āļ”āļ–āļāđāļĨāļ°āđ€āļĢāļ§)

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 32: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

āđ€āļ™āļ­āļ‡āļˆāļēāļāđ€āļĢāļēāđ„āļĄāļŠāļēāļĄāļēāļĢāļ–āđ€āļ‚āļĒāļ™āđ‚āļ›āļĢāđāļāļĢāļĄāđ€āļžāļĒāļ‡āļ„āļĢāļ‡āđ€āļ”āļĒāļ§āđƒāļŦāļ—āļēāļ‡āļēāļ™āđ„āļ”āļ–āļāļ•āļ­āļ‡āļŠāļĄāļšāļĢāļ“āđ„āļ” āļ”āļ‡āļ™āļ™āļˆāļ‡āļ•āļ­āļ‡āļĄāļ§āļ˜āļāļēāļĢāļ•āļĢāļ§āļˆāļŠāļ­āļšāļāļēāļĢāļ—āļēāļ‡āļēāļ™āļ‚āļ­āļ‡āđ‚āļ›āļĢāđāļāļĢāļĄāđ„āļ›āļ—āļĨāļ°āļ‚āļ™ āļ‹āļ‡āđ€āļĢāļēāđ€āļĢāļĒāļāļ§āļēāļāļēāļĢ

Debugging

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 33: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Debugging

āļ„āļ­āđ‚āļŦāļĄāļ”āļāļēāļĢ Run Application āđ„āļ›āļ—āļĨāļ°āļ‚āļ™āđ€āļžāļ­āļ”āļ—āļēāļ‡āļēāļ™āļ‚āļ­āļ‡ Application āđƒāļ™āļˆāļ”āļ—āđ€āļĢāļēāļŠāļ™āđƒāļˆāļ§āļēāļ—āļēāļ‡āļēāļ™āđ„āļ”āļ–āļāļ•āļ­āļ‡āļ•āļēāļĄāļ—āđ€āļĢāļēāļ•āļ­āļ‡āļāļēāļĢāļŦāļĢāļ­āđ„āļĄ āđ‚āļ”āļĒāļ‚āļ™āļ•āļ­āļ™āļ”āļ‡āļ™

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 34: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Debugging

- āđ€āļžāļĄ-āļĨāļš breakpoints āđ€āļžāļ­āļŦāļĒāļ”āđ‚āļ›āļĢāđāļāļĢāļĄāđƒāļ™āļˆāļ”āļ—āđ€āļĢāļēāļŠāļ™āđƒāļˆ

- āļ”āļ„āļēāđƒāļ™āļ•āļ§āđāļ›āļĢāļ•āļēāļ‡ āđ† āđ„āļ”āđ‚āļ”āļĒāļāļēāļĢāđ€āļ­āļē Mouse āđ„āļ›āļŠ

- Run āđāļšāļš Step in ,Step Out āđ€āļžāļ­āļ•āļĢāļ§āļˆāļŠāļ­āļšāļ‚āļ™āļ•āļ­āļ™āļāļēāļĢāļ—āļēāļ‡āļēāļ™āļ‚āļ­āļ‡āđ‚āļ›āļĢāđāļāļĢāļĄ

- NSLog āđ€āļžāļ­āđāļŠāļ”āļ‡āļ‚āļ­āļĄāļĨāļ•āļēāļ‡ āđ† āļšāļ™āļŦāļ™āļēāļ•āļēāļ‡ Console

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 35: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Understanding Errors

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 36: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Understanding Errors

āļšāļ—āļ™āļˆāļ°āļ­āļ˜āļšāļēāļĒāļ„āļ§āļēāļĄāļŦāļĄāļēāļĒāļ‚āļ­āļ‡ Error āļ•āļēāļ‡ āđ† āļ—āļĄāļāđ€āļˆāļ­āļšāļ­āļĒāļ‹āļ‡āļˆāļ°āļŠāļ§āļĒāđƒāļŦāđ€āļĢāļēāđāļāļ›āļāļŦāļēāđ„āļ”āļĢāļ§āļ”āđ€āļĢāļ§āļ‚āļ™ āđāļĨāļ°āļŠāļēāļĄāļēāļĢāļ–āļ—āļēāļāļēāļĢ Build āđ‚āļ›āļĢāđāļāļĢāļĄāđ„āļ”

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 37: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Understanding Errors

Expected ‘;’ before ...

āļŠāļēāđ€āļŦāļ• : - āļĨāļĄāđƒāļŠ ; āļ›āļ”āļ›āļĢāļ°āđ‚āļĒāļ„

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 38: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Understanding Errors

‘Something’ Undeclared

āđ„āļĄāļŠāļēāļĄāļēāļĢāļ–āļŦāļēāļ—āļĄāļēāļ‚āļ­āļ‡ Class Something āļ—āđ€āļĢāļēāđ€āļĢāļĒāļāđƒāļŠāđ„āļ”

āļŠāļēāđ€āļŦāļ• : - āđ€āļ‚āļĒāļ™āļŠāļ­ Class āļœāļ” āđ€āļŠāļ™ āļ•āļ§āđ€āļĨāļâ€“āđƒāļŦāļ - āđ„āļĄāđ„āļ” import file āļŦāļĢāļ­ import file āļœāļ” - āđ„āļĄāđ„āļ”āļ—āļēāļāļēāļĢ import Framework , library

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 39: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Understanding Errors

Statically allocated instance of Objective-C class āļŠāļēāđ€āļŦāļ• : - āļĨāļĄāđƒāļŠ * āđƒāļŦāļāļš Object āļ—āđ€āļ›āļ™āļ›āļĢāļ°āđ€āļ āļ— Dynamic

āđ€āļŠāļ™ NSString myString ; āļ—āļ–āļāļ„āļ­ NSString *myString ;

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 40: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Understanding Crash Problem

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 41: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Understanding Crash Problem

āļŦāļĨāļ‡āļˆāļēāļāļ—āđ€āļĢāļēāđāļ Error āđāļĨāļ°āļŠāļēāļĄāļēāļĢāļ– Run āđ‚āļ›āļĢāđāļāļĢāļĄāđ„āļ”āđāļĨāļ§āļˆāļ°āļžāļšāļ§āļēāđ‚āļ›āļĢāđāļāļĢāļĄāđ€āļāļ”āļāļēāļĢ Crash āđƒāļ™āļĢāļ°āļŦāļ§āļēāļ‡āļ—āļ—āļēāļ‡āļēāļ™ āđ‚āļ”āļĒāļšāļ—āļ™āļˆāļ°āļ­āļ˜āļšāļēāļĒāļāļēāļĢāđ€āļāļ” Crash āļ—āļĄāļāđ€āļˆāļ­āđ„āļ”āļšāļ­āļĒ

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 42: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Understanding Crash Problem

“EXC_BAD_ACCESS” āļŠāļēāđ€āļŦāļ• : - āļ—āļēāļāļēāļĢāđ€āļĢāļĒāļ Object āļ—āļ–āļ release āđ„āļ›āđāļĨāļ§

āđ€āļŠāļ™ NSString *myString ;

[myString release] ; // āđ„āļĄāļĄ object āđāļĨāļ§myString = @”Test” ;

āļāļēāļĢāđāļāđ„āļ‚ : - Debug āļ—āļĨāļ°āļ‚āļ™ āļŦāļĢāļ­ āđƒāļŠāđ€āļ„āļĢāļ­āļ‡āļĄāļ­ Instruments āļ•āļĢāļ§āļˆāļŦāļē Zombies Object

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 43: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Understanding Crash Problem

“SIGABRT” = SIGNAL ABORT

āđ€āļ›āļ™āļ„āļēāļŠāļ‡āđƒāļŦāļŦāļĒāļ”āļāļēāļĢāļ—āļēāļ‡āļēāļ™āļ‚āļ­āļ‡āđ‚āļ›āļĢāđāļāļĢāļĄāđ€āļ™āļ­āļ‡āļˆāļēāļāļžāļš Error āļŠāļēāđ€āļŦāļ• : - āļ—āļēāļāļēāļĢāđ€āļĢāļĒāļ Method āļ—āđ„āļĄāļĄāļ­āļĒ āļŦāļĢāļ­ āđ€āļĢāļĒāļāļœāļ” āđ€āļŠāļ™ NSString *myString ;

myString = @”Test” ;[myString releasee] ; // Method releasee āļ™āļ™āđ„āļĄāļĄāđƒāļ™ Class

āļāļēāļĢāđāļāđ„āļ‚ : - Debug āļ—āļĨāļ°āļ‚āļ™ āđāļĨāļ°āļ•āļĢāļ§āļˆāļŠāļ­āļš Warning

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 44: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Understanding Interface Builder Error

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 45: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Understanding Interface Builder Error:

āļšāļēāļ‡āļ„āļĢāļ‡āļāļēāļĢ Crash āđ‚āļ›āļĢāđāļāļĢāļĄāđ€āļāļ”āļˆāļēāļāļāļēāļĢāļ—āđ€āļĢāļēāđāļāđ„āļ‚ file XIB āđƒāļ™ Interface Builder āđ„āļ”āđ€āļŠāļ™āļāļ™ āļŠāļēāđ€āļŦāļ• : - āļāļēāļŦāļ™āļ” Class āļœāļ”āļ›āļĢāļ°āđ€āļ āļ—

āļ§āļ˜āđāļāđ„āļ‚ :

- āđ€āļ›āļ”āļŦāļ™āļēāļ•āļēāļ‡ Console āđāļĨāļ§āļ”āļšāļĢāļĢāļ—āļ”āļĨāļēāļŠāļ”āļˆāļ°āļšāļ­āļāļĢāļēāļĒāļĨāļ°āđ€āļ­āļĒāļ”āļ‚āļ­āļ‡ Class āļ— Error āļ­āļĒāđāļĨāļ§āļ—āļēāļāļēāļĢāđāļāđ„āļ‚āđƒāļŦāļ–āļāļ•āļ­āļ‡

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 46: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Workshop

āđƒāļŦāļ™āļāđ€āļĢāļĒāļ™āļ—āļē Project āļ‚āļ­āļ‡āļ•āļ§āđ€āļ­āļ‡āđāļĨāļ§āļ—āļ”āļĨāļ­āļ‡ Debug āđāļĨāļ°āđāļāđ„āļ‚ Error āļ•āļēāļ‡ āđ† āļ—āđ€āļāļ”āļ‚āļ™

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 47: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Performance Tool

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 48: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Performance Tool

- Clang Analyzer

- Instruments

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 49: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Clang Analyzer

āđ€āļ›āļ™āđ€āļ„āļĢāļ­āļ‡āļĄāļ­āđƒāļ™āļāļēāļĢāļ§āđ€āļ„āļĢāļēāļ°āļŦ Code āļ‚āļ­āļ‡āđ€āļĢāļēāļāļ­āļ™āļ—āļēāļāļēāļĢ Run āļ§āļēāđ€āļ‚āļĒāļ™āđ„āļ”āļĄāļ›āļĢāļ°āļŠāļ—āļ˜āļ āļēāļžāļŦāļĢāļ­āđ„āļĄ āđ€āļŠāļ™

- āļ•āļĢāļ§āļˆāļŠāļ­āļšāļˆāļ”āļ—āļ™āļēāļˆāļ°āđ€āļāļ” Memory Leaked āđ„āļ”

- āļ•āļĢāļ§āļˆāļŠāļ­āļšāļ•āļ§āđāļ›āļĢāļ—āđ„āļĄāļ–āļāđ€āļĢāļĒāļāđƒāļŠ

- āđ€āļĢāļĒāļāđƒāļŠāđ„āļ”āļˆāļēāļ menu Build and Analyze

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 50: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Instruments

āđ€āļ›āļ™āđ€āļ„āļĢāļ­āļ‡āļĄāļ­āđƒāļ™āļāļēāļĢāļ—āļ”āļŠāļ­āļš Performance āļ‚āļ“āļ°āļ— Run āđ‚āļ›āļĢāđāļāļĢāļĄ

- āļ•āļĢāļ§āļˆāļŠāļ­āļšāļˆāļ”āļ—āđ€āļāļ” Memory Leaked

- āļ•āļĢāļ§āļˆāļŠāļ­āļšāļāļēāļĢāļˆāļ­āļ‡āļŦāļ™āļ§āļĒāļ„āļ§āļēāļĄāļˆāļē

- āļ•āļĢāļ§āļˆāļŠāļ­āļš Zombie Object (Object āļ—āļ•āļēāļĒāļŦāļĢāļ­āļ–āļ Release āđ„āļ›āđāļĨāļ§āđāļ•āļĄāļāļēāļĢāđ€āļĢāļĒāļāđƒāļŠāļ­āļ āđ€āļ›āļĢāļĒāļšāđ€āļŠāļĄāļ­āļ™ Zombie āļ—āļ•āļēāļĒāđāļĨāļ§āļ–āļāđ€āļĢāļĒāļāļ›āļĨāļāļ‚āļ™āļĄāļēāđƒāļŦāļĄ)

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 51: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Workshop

āđƒāļŦāļ™āļāđ€āļĢāļĒāļ™āļ—āļēāļāļēāļĢ Test Performance Project āļ‚āļ­āļ‡āļ•āļ§āđ€āļ­āļ‡āļ”āļ§āļĒāđ€āļ„āļĢāļ­āļ‡āļĄāļ­ Analyzer āđāļĨāļ° Instruments

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 52: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Submit AppStore

- āđ€āļ›āļ”āļ•āļ§āļ§āļ™āļ— 10 July 2008- āđ€āļ›āļ™āļ„āļĢāļ‡āđāļĢāļāđāļĨāļ°āđ€āļ›āļ™āļŠāļ­āļ‡āļ—āļēāļ‡āļ—āļ‡āļēāļĒāļ—āļŠāļ”āļ—āļˆāļ°āļ—āļēāđƒāļŦāļ™āļāļžāļ’āļ™āļēāļŠāļēāļĄāļēāļĢāļ–āļ‚āļēāļĒ Application āđƒāļŦāļāļšāļ„āļ™ 155 āļ›āļĢāļ°āđ€āļ—āļĻāļ—āļ§āđ‚āļĨāļ- āļœāđƒāļŠ 400 āļĨāļēāļ™āļ„āļ™āļ—āļĄāļšāļ•āļĢ Credit

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 53: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Submit AppStore

5-March-2012 - āļˆāļēāļ™āļ§āļ™ App āļĢāļ§āļĄ (iPhone/iPad/iPod Touch) āļ„āļ­ 550,000+- āļˆāļēāļ™āļ§āļ™ App āļšāļ™ iPad āļ„āļ­ 170,000 +- āļĒāļ­āļ” AppStore Download 25,000 āļĨāļēāļ™āļ„āļĢāļ‡

12-June-2012- āļ›āļˆāļˆāļšāļ™āļˆāļēāļ™āļ§āļ™ App āļĢāļ§āļĄ (iPhone/iPad/iPod Touch) āļ„āļ­ 650,000+- āļˆāļēāļ™āļ§āļ™ App āļšāļ™ iPad āļ„āļ­ 225,000 +- āļĒāļ­āļ” AppStore Download 30,000 āļĨāļēāļ™āļ„āļĢāļ‡

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 54: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

Submit AppStore

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 55: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 56: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 57: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 58: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 59: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 60: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 61: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 62: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

In-App Purchases (Freemium Model)

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 63: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

In-App Purchases (Tiny Tower)

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 64: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

In-App Purchases

Order and Chaos NBA Jam

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 65: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

In-App Purchases (The Smurfs Village)

8-Year-Old Girl Racks Up $1400 Bill Buying Smurfberries in Smurf's Village

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 66: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

In-App Purchases (Restrictions)

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13

Page 67: (1 July 2013) iOS Basic Development Day 5 - Submit to App Store

by Eakapong Kattiya www.ibluecode.com [email protected] +66 086-673-2111Saturday, June 15, 13


Top Related