際際滷

際際滷Share a Scribd company logo
iOS Basic Development
User Selection Design
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Social Share
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
UIActionSheet
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
- (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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Social Framework
Facebook
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
- (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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Social Framework
Twitter
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
- (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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
UIDocumentInteractionController
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
- (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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
- (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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
UIAlertView
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
-(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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
MFMailComposeViewController
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
- (IBAction)directSendMail:(id)sender {
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailVC = [[MFMailComposeViewController alloc] init];
mailVC.mailComposeDelegate = self;
[mailVC setSubject:@"Subject"];
NSArray *toRecipients = [NSArray arrayWithObjects:
@"eak.k@ibluecode.com",
@"eakkattiya@gmail.com", 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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
UIPickerView
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
犖犖迦牽犢犖犖朽権犖犢犖犢犖犖迦
1. Init UIPickerView
2. bind Datasouce / Delegate
3. 犖犢犖迦見犖犖犖犖犖ム険犖÷犢
numberOfComponentsInPickerView
4. 犖犢犖迦見犖犖犖犢犖迦犖о犢犖犖
pickerView:numberOfRowsInComponent:
5. 犖犢犖迦見犖犖犖犖迦牽犢犖犖犖犖犢犖迦犖犢犖 Text 犖犖犖劇賢View 犢犖犢
pickerView:titleForRow:forComponent:
pickerView:viewForRow:forComponent:reusingView:
6. 犢犖犢 Delegate 犢犖÷厳犢犖犢犖ム厳犖犖犖犢犖犖÷弦犖ム犖犖犢犖
pickerView:didSelectRow:inComponent
UIPickerView
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Top Secret
Saturday, June 15, 13
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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
iOS Basic Development
Submit App Store
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
犖犖ム険犖犖犖迦犖犖朽犖犖園犢犖犖朽権犖犢犖犢犢犖犖朽権犖犖犖項犖犖迦牽犖犖劇犖犖犖迦犖犖迦牽犢犖犖朽権犖犢犖犖犢犖犖犖
犖犖 iPhone 犢犖ム鍵犖犖迦牽犢犖犢Tool 犖犢犖迦 犢 犢犖犢犖犖朽権犖犖犢犖犖∇犖ム犖
犖犖園犢犖犖朽権犖犖犢犖犢犖迦犖迦牽犢犖犖朽権犖犢犖犖犢犖犖犖÷犖犢犖犖∇犖迦犖犖迦犖犖劇犖 犖犖萎見犖о犖迦犖犖朽
犢犖犖朽権犖 Code 犖犖園犖犖犢犢犖÷犖÷元 Error 犖犖萎犖 犖犖迦検犖迦牽犖 Compile 犢犖ム鍵
Run Application 犢犖犢犢犖犖∇犖÷犖÷元犖犖迦牽 Crash 犖犖犖犢犖犖犢犖犖犖÷犖ム鍵
犖犖迦牽犖犢犖迦犖迦犖犢犖迦 犢 犖犖園犖犖犖о犢犖犢犖о犖項犖犢犖犖犖犖迦検犖犖朽犖犖犖犢犖犖犢犖о犖犖伍
犖犖犖萎犖迦牽.....
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
犖犖ム険犖犖犖迦犖犖朽犖犖園犢犖犖朽権犖犢犖犢犢犖犖朽権犖犖犖項犖犖迦牽犖犖劇犖犖犖迦犖犖迦牽犢犖犖朽権犖犢犖犖犢犖犖犖
犖犖 iPhone 犢犖ム鍵犖犖迦牽犢犖犢Tool 犖犢犖迦 犢 犢犖犢犖犖朽権犖犖犢犖犖∇犖ム犖
犖犖園犢犖犖朽権犖犖犢犖犢犖迦犖迦牽犢犖犖朽権犖犢犖犖犢犖犖犖÷犖犢犖犖∇犖迦犖犖迦犖犖劇犖 犖犖萎見犖о犖迦犖犖朽
犢犖犖朽権犖 Code 犖犖園犖犖犢犢犖÷犖÷元 Error 犖犖萎犖 犖犖迦検犖迦牽犖 Compile 犢犖ム鍵
Run Application 犢犖犢犢犖犖∇犖÷犖÷元犖犖迦牽 Crash 犖犖犖犢犖犖犢犖犖犖÷犖ム鍵
犖犖迦牽犖犢犖迦犖迦犖犢犖迦 犢 犖犖園犖犖犖о犢犖犢犖о犖項犖犢犖犖犖犖迦検犖犖朽犖犖犖犢犖犖犢犖о犖犖伍
犖犖犖萎犖迦牽.....
犢犖犢犖犖犖劇賢犢犖÷ ?
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
犢犖犖∇犖犖犖巌犖ム犖о犖園犖犖犖犖犖犖迦牽犢犖犖朽権犖犢犖犖犢犖犖犖
犖犖萎見犖о犖迦犖犖朽 犖犢犖迦犖迦牽 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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
犢犖犖劇犖犖犖犖迦犢犖犖迦犖÷犖犖迦検犖迦牽犖犢犖犖朽権犖犢犖犖犢犖犖犖÷犖犖朽権犖
犖犖犖園犖犢犖犖朽権犖о犖犢犖犢犖迦犖迦犢犖犢犖犖項犖犢犖犖犖犖÷犖項牽犖犢犢犖犢 犖犖園
犖犖園犖犖犖謹犖犢犖犖犖÷元犖о鹸犖犖朽犖迦牽犖犖犖о犖犖犖犖犖迦牽犖犢犖迦犖迦犖犖犖
犢犖犖犢犖犖犖÷犖犖犖朽献犖萎犖園犖 犖犖謹犖犢犖犖迦犖犖朽権犖犖о犖迦犖迦牽
Debugging
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Debugging
犖犖劇賢犢犖犖÷犖犖迦牽 Run Application 犢犖犖犖朽献犖萎犖園犖犢犖犖劇犖犖犖項犢犖迦犖迦犖犖犖
Application 犢犖犖犖伍犖犖朽犢犖犖迦肩犖犢犖犖о犖迦犢犖迦犖迦犢犖犢犖犖項犖犢犖犖犖犖迦検犖犖朽犢犖犖
犖犢犖犖犖犖迦牽犖犖犖劇賢犢犖÷ 犢犖犖∇犖園犖犖犖犖犖犖園犖犖朽
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Debugging
- 犢犖犖巌犖-犖ム breakpoints 犢犖犖劇犖犖犖∇幻犖犢犖犖犢犖犖犖÷犖犖犖伍犖犖朽犢犖犖迦肩犖犢犖
- 犖犖項犢犖迦犖犖犖園硯犢犖犖犖犢犖迦 犢 犢犖犢犢犖犖∇犖迦牽犢犖犖 Mouse 犢犖犖犖朽
- Run 犢犖犖 Step in ,Step Out 犢犖犖劇犖犖犖犖о犖犖犖犖犖園犖犖犖犖犖犖迦牽
犖犢犖迦犖迦犖犖犖犢犖犖犢犖犖犖
- NSLog 犢犖犖劇犖犢犖犖犖犖犢犖犖÷弦犖ム犢犖迦 犢 犖犖犖犖犢犖迦犢犖迦 Console
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Understanding Errors
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Understanding Errors
犖犖犖犖朽犖犖萎賢犖犖巌犖迦権犖犖о顕犖÷見犖÷顕犖∇犖犖 Error 犖犢犖迦 犢 犖犖朽犖÷険犖犢犖犖犖犢犖犖∇犖謹犖
犖犖萎犢犖о権犢犖犢犢犖犖迦犖犢犖犖園犖犖迦犖犢犖犖о犢犖犢犖о犖謹犖 犢犖ム鍵犖犖迦検犖迦牽犖犖犢犖迦犖迦牽
Build 犢犖犖犢犖犖犖÷犖犢
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Understanding Errors
Expected ; before ...
犖犖迦犖犖犖 :
- 犖ム厳犖÷犖犢 ; 犖犖巌犖犖犖萎犖∇
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Understanding Errors
Something Undeclared
犢犖÷犖犖迦検犖迦牽犖犖犖迦犖朽犖÷顕犖犖犖 Class Something 犖犖朽犢犖犖迦犖犖朽権犖犢犖犢犢犖犢
犖犖迦犖犖犖 :
- 犢犖犖朽権犖犖犖劇犖 Class 犖犖巌 犢犖犢犖 犖犖園硯犢犖ム犖犢犖犖犢
- 犢犖÷犢犖犢 import 鍖le 犖犖犖劇賢 import 鍖le 犖犖巌
- 犢犖÷犢犖犢犖犢犖迦犖迦牽 import Framework , library
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Understanding Errors
Statically allocated instance of Objective-C class
犖犖迦犖犖犖 :
- 犖ム厳犖÷犖犢 * 犢犖犢犖犖園 Object 犖犖朽犢犖犢犖犖犖犖萎犖犖 Dynamic
犢犖犢犖
NSString myString ;
犖犖朽犖犖項犖犖劇賢
NSString *myString ;
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Understanding Crash Problem
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Understanding Crash Problem
犖犖ム険犖犖犖迦犖犖朽犢犖犖迦犖犢 Error 犢犖ム鍵犖犖迦検犖迦牽犖 Run 犢犖犖犢犖犖犖÷犖犢犢犖ム犖о犖
犖犖犖о犖迦犖犖犢犖犖犖÷犖犖巌犖犖迦牽 Crash 犢犖犖犖萎見犖о犖迦犖犖朽犖犢犖迦犖迦 犢犖犖∇犖犖犖朽
犖犖萎賢犖犖巌犖迦権犖犖迦牽犢犖犖巌 Crash 犖犖朽犖÷険犖犢犖犖犢犖犢犖犢犖犖
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
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 eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Understanding Interface Builder Error
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Understanding Interface Builder Error:
犖犖迦犖犖犖園犖犖犖迦牽 Crash 犢犖犖犢犖犖犖÷犖犖巌犖犖迦犖犖迦牽犖犖朽犢犖犖迦犖犢犢犖 鍖le
XIB 犢犖 Interface Builder 犢犖犢犢犖犢犖犖犖園
犖犖迦犖犖犖 :
- 犖犢犖迦見犖犖 Class 犖犖巌犖犖犖萎犖犖
犖о鹸犖犖朽犖犢犢犖 :
- 犢犖犖巌犖犖犢犖迦犢犖迦 Console 犢犖ム犖о犖項犖犖犖犖園犖ム犖迦肩犖伍犖犖萎犖犖犖犖迦権
犖ム鍵犢犖犖朽権犖犖犖犖 Class 犖犖朽 Error 犖犖∇弦犢犢犖ム犖о犢犖迦犖迦牽犢犖犢犢犖犢犖犢犖犖項犖犢犖犖
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Workshop
犢犖犢犖犖園犢犖犖朽権犖犖犢犖 Project 犖犖犖犖犖園硯犢犖犖犢犖ム犖о犖犖ム賢犖 Debug 犢犖ム鍵
犢犖犢犢犖 Error 犖犢犖迦 犢 犖犖朽犢犖犖巌犖犖謹犖
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
PerformanceTool
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
PerformanceTool
- Clang Analyzer
- Instruments
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Clang Analyzer
犢犖犢犖犢犖犖犖劇犖犖犖÷厳犖犢犖犖犖迦牽犖о鹸犢犖犖犖迦鍵犖犢 Code 犖犖犖犢犖犖迦犢犖犖犖犢犖迦犖迦牽 Run
犖о犖迦犖犖朽権犖犢犖犢犖÷元犖犖犖萎肩犖巌犖犖巌犖迦犖犖犖劇賢犢犖÷ 犢犖犢犖
- 犖犖犖о犖犖犖犖犖伍犖犖朽犖犢犖迦犖萎犖犖巌 Memory Leaked 犢犖犢
- 犖犖犖о犖犖犖犖犖園硯犢犖犖犖犖朽犢犖÷犖犖項犢犖犖朽権犖犢犖犢
- 犢犖犖朽権犖犢犖犢犢犖犢犖犖迦 menu Build and Analyze
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Instruments
犢犖犢犖犢犖犖犖劇犖犖犖÷厳犖犢犖犖犖迦牽犖犖犖犖犖 Performance 犖犖犖萎犖朽 Run
犢犖犖犢犖犖犖
- 犖犖犖о犖犖犖犖犖伍犖犖朽犢犖犖巌 Memory Leaked
- 犖犖犖о犖犖犖犖犖迦牽犖犖犖犖犖犢犖о権犖犖о顕犖÷犢犖
- 犖犖犖о犖犖犖 Zombie Object
(Object 犖犖朽犖犖迦権犖犖犖劇賢犖犖項 Release 犢犖犢犖ム犖о犖犢犖÷元犖犖迦牽犢犖犖朽権犖犢犖犢犖犖朽
犢犖犖犖朽権犖犢犖犖÷厳犖犖 Zombie 犖犖朽犖犖迦権犢犖ム犖о犖項犢犖犖朽権犖犖犖ム幻犖犖犖謹犖犖÷顕犢犖犖÷)
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Workshop
犢犖犢犖犖園犢犖犖朽権犖犖犢犖迦犖迦牽Test Performance Project 犖犖犖犖犖園硯犢犖犖
犖犢犖о権犢犖犖犖劇犖犖犖÷厳犖 Analyzer 犢犖ム鍵 Instruments
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Submit AppStore
- 犢犖犖巌犖犖園硯犖о険犖犖犖朽 10 July 2008
- 犢犖犢犖犖犖犖園犖犢犖犖犢犖ム鍵犢犖犢犖犖犢犖犖犖犖迦犖犖朽犖犢犖迦権犖犖朽犖犖伍犖犖朽犖犖萎犢犖迦犖犢犖犖園犖犖園犖犖
犖犖迦検犖迦牽犖犖犖迦権 Application 犢犖犢犖犖園犖犖 155 犖犖犖萎犖犖犖犖園犖о犖ム
- 犖犖項犢犖犢 400 犖ム犖迦犖犖犖犖朽犖朽検犖朽犖園犖 Credit
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Submit AppStore
5-March-2012
- 犖犢犖迦犖о App 犖犖о検 (iPhone/iPad/iPodTouch) 犖犖劇賢 550,000+
- 犖犢犖迦犖о App 犖犖 iPad 犖犖劇賢 170,000 +
- 犖∇賢犖 AppStore Download 25,000 犖ム犖迦犖犖犖園犖
12-June-2012
- 犖犖園犖犖伍犖園犖犢犖迦犖о App 犖犖о検 (iPhone/iPad/iPodTouch) 犖犖劇賢 650,000+
- 犖犢犖迦犖о App 犖犖 iPad 犖犖劇賢 225,000 +
- 犖∇賢犖 AppStore Download 30,000 犖ム犖迦犖犖犖園犖
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
Submit AppStore
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
In-App Purchases (Freemium Model)
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
In-App Purchases (TinyTower)
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
In-App Purchases
Order and Chaos NBA Jam
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
In-App Purchases (The SmurfsVillage)
8-Year-Old Girl Racks Up $1400 Bill Buying Smurfberries in Smurf'sVillage
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
In-App Purchases (Restrictions)
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13
by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111
Saturday, June 15, 13

More Related Content

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

  • 1. iOS Basic Development User Selection Design by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 2. Social Share by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 3. UIActionSheet by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 4. - (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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 5. Social Framework Facebook by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 6. - (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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 7. Social Framework Twitter by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 8. - (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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 9. UIDocumentInteractionController by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 10. - (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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 11. - (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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 12. UIAlertView by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 13. -(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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 14. MFMailComposeViewController by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 15. - (IBAction)directSendMail:(id)sender { if ([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *mailVC = [[MFMailComposeViewController alloc] init]; mailVC.mailComposeDelegate = self; [mailVC setSubject:@"Subject"]; NSArray *toRecipients = [NSArray arrayWithObjects: @"eak.k@ibluecode.com", @"eakkattiya@gmail.com", 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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 16. UIPickerView by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 17. 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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 18. 犖犖迦牽犢犖犖朽権犖犢犖犢犖犖迦 1. Init UIPickerView 2. bind Datasouce / Delegate 3. 犖犢犖迦見犖犖犖犖犖ム険犖÷犢 numberOfComponentsInPickerView 4. 犖犢犖迦見犖犖犖犢犖迦犖о犢犖犖 pickerView:numberOfRowsInComponent: 5. 犖犢犖迦見犖犖犖犖迦牽犢犖犖犖犖犢犖迦犖犢犖 Text 犖犖犖劇賢View 犢犖犢 pickerView:titleForRow:forComponent: pickerView:viewForRow:forComponent:reusingView: 6. 犢犖犢 Delegate 犢犖÷厳犢犖犢犖ム厳犖犖犖犢犖犖÷弦犖ム犖犖犢犖 pickerView:didSelectRow:inComponent UIPickerView by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 19. 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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 20. 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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 21. 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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 22. 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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 23. 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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 24. by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Top Secret Saturday, June 15, 13
  • 25. 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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 26. iOS Basic Development Submit App Store by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 27. 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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 28. 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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 29. 犖犖ム険犖犖犖迦犖犖朽犖犖園犢犖犖朽権犖犢犖犢犢犖犖朽権犖犖犖項犖犖迦牽犖犖劇犖犖犖迦犖犖迦牽犢犖犖朽権犖犢犖犖犢犖犖犖 犖犖 iPhone 犢犖ム鍵犖犖迦牽犢犖犢Tool 犖犢犖迦 犢 犢犖犢犖犖朽権犖犖犢犖犖∇犖ム犖 犖犖園犢犖犖朽権犖犖犢犖犢犖迦犖迦牽犢犖犖朽権犖犢犖犖犢犖犖犖÷犖犢犖犖∇犖迦犖犖迦犖犖劇犖 犖犖萎見犖о犖迦犖犖朽 犢犖犖朽権犖 Code 犖犖園犖犖犢犢犖÷犖÷元 Error 犖犖萎犖 犖犖迦検犖迦牽犖 Compile 犢犖ム鍵 Run Application 犢犖犢犢犖犖∇犖÷犖÷元犖犖迦牽 Crash 犖犖犖犢犖犖犢犖犖犖÷犖ム鍵 犖犖迦牽犖犢犖迦犖迦犖犢犖迦 犢 犖犖園犖犖犖о犢犖犢犖о犖項犖犢犖犖犖犖迦検犖犖朽犖犖犖犢犖犖犢犖о犖犖伍 犖犖犖萎犖迦牽..... by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 30. 犖犖ム険犖犖犖迦犖犖朽犖犖園犢犖犖朽権犖犢犖犢犢犖犖朽権犖犖犖項犖犖迦牽犖犖劇犖犖犖迦犖犖迦牽犢犖犖朽権犖犢犖犖犢犖犖犖 犖犖 iPhone 犢犖ム鍵犖犖迦牽犢犖犢Tool 犖犢犖迦 犢 犢犖犢犖犖朽権犖犖犢犖犖∇犖ム犖 犖犖園犢犖犖朽権犖犖犢犖犢犖迦犖迦牽犢犖犖朽権犖犢犖犖犢犖犖犖÷犖犢犖犖∇犖迦犖犖迦犖犖劇犖 犖犖萎見犖о犖迦犖犖朽 犢犖犖朽権犖 Code 犖犖園犖犖犢犢犖÷犖÷元 Error 犖犖萎犖 犖犖迦検犖迦牽犖 Compile 犢犖ム鍵 Run Application 犢犖犢犢犖犖∇犖÷犖÷元犖犖迦牽 Crash 犖犖犖犢犖犖犢犖犖犖÷犖ム鍵 犖犖迦牽犖犢犖迦犖迦犖犢犖迦 犢 犖犖園犖犖犖о犢犖犢犖о犖項犖犢犖犖犖犖迦検犖犖朽犖犖犖犢犖犖犢犖о犖犖伍 犖犖犖萎犖迦牽..... 犢犖犢犖犖犖劇賢犢犖÷ ? by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 31. 犢犖犖∇犖犖犖巌犖ム犖о犖園犖犖犖犖犖犖迦牽犢犖犖朽権犖犢犖犖犢犖犖犖 犖犖萎見犖о犖迦犖犖朽 犖犢犖迦犖迦牽 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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 33. Debugging 犖犖劇賢犢犖犖÷犖犖迦牽 Run Application 犢犖犖犖朽献犖萎犖園犖犢犖犖劇犖犖犖項犢犖迦犖迦犖犖犖 Application 犢犖犖犖伍犖犖朽犢犖犖迦肩犖犢犖犖о犖迦犢犖迦犖迦犢犖犢犖犖項犖犢犖犖犖犖迦検犖犖朽犢犖犖 犖犢犖犖犖犖迦牽犖犖犖劇賢犢犖÷ 犢犖犖∇犖園犖犖犖犖犖犖園犖犖朽 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 34. Debugging - 犢犖犖巌犖-犖ム breakpoints 犢犖犖劇犖犖犖∇幻犖犢犖犖犢犖犖犖÷犖犖犖伍犖犖朽犢犖犖迦肩犖犢犖 - 犖犖項犢犖迦犖犖犖園硯犢犖犖犖犢犖迦 犢 犢犖犢犢犖犖∇犖迦牽犢犖犖 Mouse 犢犖犖犖朽 - Run 犢犖犖 Step in ,Step Out 犢犖犖劇犖犖犖犖о犖犖犖犖犖園犖犖犖犖犖犖迦牽 犖犢犖迦犖迦犖犖犖犢犖犖犢犖犖犖 - NSLog 犢犖犖劇犖犢犖犖犖犖犢犖犖÷弦犖ム犢犖迦 犢 犖犖犖犖犢犖迦犢犖迦 Console by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 35. Understanding Errors by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 36. Understanding Errors 犖犖犖犖朽犖犖萎賢犖犖巌犖迦権犖犖о顕犖÷見犖÷顕犖∇犖犖 Error 犖犢犖迦 犢 犖犖朽犖÷険犖犢犖犖犖犢犖犖∇犖謹犖 犖犖萎犢犖о権犢犖犢犢犖犖迦犖犢犖犖園犖犖迦犖犢犖犖о犢犖犢犖о犖謹犖 犢犖ム鍵犖犖迦検犖迦牽犖犖犢犖迦犖迦牽 Build 犢犖犖犢犖犖犖÷犖犢 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 37. Understanding Errors Expected ; before ... 犖犖迦犖犖犖 : - 犖ム厳犖÷犖犢 ; 犖犖巌犖犖犖萎犖∇ by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 38. Understanding Errors Something Undeclared 犢犖÷犖犖迦検犖迦牽犖犖犖迦犖朽犖÷顕犖犖犖 Class Something 犖犖朽犢犖犖迦犖犖朽権犖犢犖犢犢犖犢 犖犖迦犖犖犖 : - 犢犖犖朽権犖犖犖劇犖 Class 犖犖巌 犢犖犢犖 犖犖園硯犢犖ム犖犢犖犖犢 - 犢犖÷犢犖犢 import 鍖le 犖犖犖劇賢 import 鍖le 犖犖巌 - 犢犖÷犢犖犢犖犢犖迦犖迦牽 import Framework , library by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 39. Understanding Errors Statically allocated instance of Objective-C class 犖犖迦犖犖犖 : - 犖ム厳犖÷犖犢 * 犢犖犢犖犖園 Object 犖犖朽犢犖犢犖犖犖犖萎犖犖 Dynamic 犢犖犢犖 NSString myString ; 犖犖朽犖犖項犖犖劇賢 NSString *myString ; by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 40. Understanding Crash Problem by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 41. Understanding Crash Problem 犖犖ム険犖犖犖迦犖犖朽犢犖犖迦犖犢 Error 犢犖ム鍵犖犖迦検犖迦牽犖 Run 犢犖犖犢犖犖犖÷犖犢犢犖ム犖о犖 犖犖犖о犖迦犖犖犢犖犖犖÷犖犖巌犖犖迦牽 Crash 犢犖犖犖萎見犖о犖迦犖犖朽犖犢犖迦犖迦 犢犖犖∇犖犖犖朽 犖犖萎賢犖犖巌犖迦権犖犖迦牽犢犖犖巌 Crash 犖犖朽犖÷険犖犢犖犖犢犖犢犖犢犖犖 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 42. 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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 43. 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 eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 44. Understanding Interface Builder Error by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 45. Understanding Interface Builder Error: 犖犖迦犖犖犖園犖犖犖迦牽 Crash 犢犖犖犢犖犖犖÷犖犖巌犖犖迦犖犖迦牽犖犖朽犢犖犖迦犖犢犢犖 鍖le XIB 犢犖 Interface Builder 犢犖犢犢犖犢犖犖犖園 犖犖迦犖犖犖 : - 犖犢犖迦見犖犖 Class 犖犖巌犖犖犖萎犖犖 犖о鹸犖犖朽犖犢犢犖 : - 犢犖犖巌犖犖犢犖迦犢犖迦 Console 犢犖ム犖о犖項犖犖犖犖園犖ム犖迦肩犖伍犖犖萎犖犖犖犖迦権 犖ム鍵犢犖犖朽権犖犖犖犖 Class 犖犖朽 Error 犖犖∇弦犢犢犖ム犖о犢犖迦犖迦牽犢犖犢犢犖犢犖犢犖犖項犖犢犖犖 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 46. Workshop 犢犖犢犖犖園犢犖犖朽権犖犖犢犖 Project 犖犖犖犖犖園硯犢犖犖犢犖ム犖о犖犖ム賢犖 Debug 犢犖ム鍵 犢犖犢犢犖 Error 犖犢犖迦 犢 犖犖朽犢犖犖巌犖犖謹犖 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 47. PerformanceTool by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 48. PerformanceTool - Clang Analyzer - Instruments by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 49. Clang Analyzer 犢犖犢犖犢犖犖犖劇犖犖犖÷厳犖犢犖犖犖迦牽犖о鹸犢犖犖犖迦鍵犖犢 Code 犖犖犖犢犖犖迦犢犖犖犖犢犖迦犖迦牽 Run 犖о犖迦犖犖朽権犖犢犖犢犖÷元犖犖犖萎肩犖巌犖犖巌犖迦犖犖犖劇賢犢犖÷ 犢犖犢犖 - 犖犖犖о犖犖犖犖犖伍犖犖朽犖犢犖迦犖萎犖犖巌 Memory Leaked 犢犖犢 - 犖犖犖о犖犖犖犖犖園硯犢犖犖犖犖朽犢犖÷犖犖項犢犖犖朽権犖犢犖犢 - 犢犖犖朽権犖犢犖犢犢犖犢犖犖迦 menu Build and Analyze by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 50. Instruments 犢犖犢犖犢犖犖犖劇犖犖犖÷厳犖犢犖犖犖迦牽犖犖犖犖犖 Performance 犖犖犖萎犖朽 Run 犢犖犖犢犖犖犖 - 犖犖犖о犖犖犖犖犖伍犖犖朽犢犖犖巌 Memory Leaked - 犖犖犖о犖犖犖犖犖迦牽犖犖犖犖犖犢犖о権犖犖о顕犖÷犢犖 - 犖犖犖о犖犖犖 Zombie Object (Object 犖犖朽犖犖迦権犖犖犖劇賢犖犖項 Release 犢犖犢犖ム犖о犖犢犖÷元犖犖迦牽犢犖犖朽権犖犢犖犢犖犖朽 犢犖犖犖朽権犖犢犖犖÷厳犖犖 Zombie 犖犖朽犖犖迦権犢犖ム犖о犖項犢犖犖朽権犖犖犖ム幻犖犖犖謹犖犖÷顕犢犖犖÷) by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 51. Workshop 犢犖犢犖犖園犢犖犖朽権犖犖犢犖迦犖迦牽Test Performance Project 犖犖犖犖犖園硯犢犖犖 犖犢犖о権犢犖犖犖劇犖犖犖÷厳犖 Analyzer 犢犖ム鍵 Instruments by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 52. Submit AppStore - 犢犖犖巌犖犖園硯犖о険犖犖犖朽 10 July 2008 - 犢犖犢犖犖犖犖園犖犢犖犖犢犖ム鍵犢犖犢犖犖犢犖犖犖犖迦犖犖朽犖犢犖迦権犖犖朽犖犖伍犖犖朽犖犖萎犢犖迦犖犢犖犖園犖犖園犖犖 犖犖迦検犖迦牽犖犖犖迦権 Application 犢犖犢犖犖園犖犖 155 犖犖犖萎犖犖犖犖園犖о犖ム - 犖犖項犢犖犢 400 犖ム犖迦犖犖犖犖朽犖朽検犖朽犖園犖 Credit by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 53. Submit AppStore 5-March-2012 - 犖犢犖迦犖о App 犖犖о検 (iPhone/iPad/iPodTouch) 犖犖劇賢 550,000+ - 犖犢犖迦犖о App 犖犖 iPad 犖犖劇賢 170,000 + - 犖∇賢犖 AppStore Download 25,000 犖ム犖迦犖犖犖園犖 12-June-2012 - 犖犖園犖犖伍犖園犖犢犖迦犖о App 犖犖о検 (iPhone/iPad/iPodTouch) 犖犖劇賢 650,000+ - 犖犢犖迦犖о App 犖犖 iPad 犖犖劇賢 225,000 + - 犖∇賢犖 AppStore Download 30,000 犖ム犖迦犖犖犖園犖 by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 54. Submit AppStore by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 55. by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 56. by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 57. by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 58. by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 59. by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 60. by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 61. by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 62. In-App Purchases (Freemium Model) by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 63. In-App Purchases (TinyTower) by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 64. In-App Purchases Order and Chaos NBA Jam by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 65. In-App Purchases (The SmurfsVillage) 8-Year-Old Girl Racks Up $1400 Bill Buying Smurfberries in Smurf'sVillage by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 66. In-App Purchases (Restrictions) by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13
  • 67. by Eakapong Kattiya www.ibluecode.com eak.k@ibluecode.com +66 086-673-2111 Saturday, June 15, 13