SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
ARC              iOS


      (id:ninjinkun / @ninjinkun)
•   Cocoa Touch

•   ARC

•   ARC

•
•   ARC

•
•   Tips
•          GC
Cocoa Touch

 •    retain / relase
     -(void)setName:(NSString *)newName {
         name = [newName retain];
     }

     -(void)dealloc {
         [name release];
         [super dealloc];                      1       3   0
     }



 •    Ownership

     •   Ownership                            retain

     •   Ownership                          release

 •                     0
Cocoa Touch
Autorelase

 •
 •   autorelease

 •                 release

 •                           /

     •
Cocoa Touch
Autorelase

 •
 •    autorelease

 •                                release

 •                                                        /

      •
  -(void)buildNewName {
      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

          NSMutableArray *array = [[[NSMutableArray alloc] init] autorelease];
          [array addObject:@"hoge"];
          [array addObject:@"fuga"];
          [array addObject:@"piyo"];
          name =[array componentsJoinedByString:@","];

          [pool drain];
  }
ARC

•   Automatic Reference Counting
•
•   iOS 5 / Mac OS X 10.7
ARC

•
    •

•                     (GC)

•   Static Analyzer
ARC

•
    @interface NonARCObject : NSObject {
        NSString *name;
    }
    -(id)initWithName:(NSString *)name;
    @end

    @implementation NonARCObject

    -(id)initWithName:(NSString *)newName {
        self = [super init];
        if (self) {
            name = [newName retain];
        }
        return self;
    }

    -(void)dealloc {
         [name release];
         [super dealloc];
    }
    @end
ARC

•
    @interface ARCObject : NSObject {
        NSString *name;
    }
    -(id)initWithName:(NSString *)name;
    @end

    @implementation ARCObject

    -(id)initWithName:(NSString *)newName {
        self = [super init];
        if (self) {
            name = newName;
        }
        return self;
    }

    @end
ARC
ARC

 •
     •   …

 •
     •
 •
 •
ARC
                  __strong

•
•   Ownership

•
    •                  retain,                                release
    -(void)buildNewName {
        {
            __strong NSMutableArray *array = [[NSMutableArray alloc] init];
            [array addObject:@"hoge"];
            [array addObject:@"fuga"];
            [array addObject:@"piyo"];
            name =[array componentsJoinedByString:@","];
        }
    }



                                                                   !
ARC
                  __strong

•
    •                  retain, dealloc                   relase

    @interface ARCUser : NSObject {
        __strong NSString *name;
    }
    @end

    @implementation ARCUser

    -(id)initWithName:(NSString *)newName {
        self = [super init];
        if (self) {
            name = newName; //                 [newName retain]
        }
        return self;
    }

    -(void)dealloc {
        //                    [name release]
    }
    @end
ARC
                   __weak

•    __weak
    •
    •   Ownership

    •                                 nil

        •
    •   iOS 5

    @interface ARCUser : NSObject {
        __weak id delegate;
    }
    @end
ARC
                    __unsafe_unretainded

•
    •    assign

•
•   iOS 4.3
        @interface ARCUser : NSObject {
            __unsafe_unretained id delegate;
        }
        @end
ARC
                 __autoreleasing

•   autorelase

•
•                   @autorelasepool { }
     -(NSArray *)comvertImageToJpeg:(NSArray *)files {
         NSMutableArray *dataStore = [NSMutableArray array];
         @autoreleasepool {
             for (NSString *filePath in files) {
                 __autoreleasing UIImage *image = [[UIImage alloc]
     initWithContentsOfFile:filePath];
                 NSData *data = UIImageJPEGRepresentation(image, 1.0);
                 [dataStore addObject:data];
             }
         }
         return [dataStore copy];
     }
ARC

•   retain, release, autorelase

    •    retainCount

•   [super dealloc]

    •    dealloc
           -(void)dealloc {
               delegate = nil;
           }



•   C                                              __bridge
        NSString *str = @"hogehoge";
        CFStringRef strRef = (__bridge CFStringRef)str;


    CFStringRef strRef = (__bridge_retained CFStringRef)str;
•   ARC   __strong

•           __strong



                __strong

                        __strong



            __strong               __strong



                       __strong
•   iOS 5           __weak

•   iOS 4.3          __unsafe_unretaind

•             nil

                         __strong

                                 __weak



                     __strong              __strong



                                __strong
ARC

•
ARC
retain / relase

 •   -S

     •
 •   _objc_release()
 •   _objc_retain()
 •   _objc_retainAutoreleasedReturnValue()
ARC
__weak

 •   _objc_storeWeak()

 •                  0    _objc_destroyWeak()

     •
     •             nil

     •


                                    This document is licensed to ninjin@mac.com.
Blocks

 •   ARC

 •   self                             ?

     •
 •   release

 •   BlocksKit
     UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
     [button addEventHandler:^(id sender) {
         [self showPhotoPickerView];
     } forControlEvents:UIControlEventTouchUpInside];
     [self.view addSubview:button];
Blocks

 •
  UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

  __unsafe_unretained id _self = self; // !?

  [button addEventHandler:^(id sender) {
      [_self showPhotoPickerView];
  } forControlEvents:UIControlEventTouchUpInside];
  [self.view addSubview:button];
Blocks

 •
  UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

  __unsafe_unretained id _self = self; // !?

  [button addEventHandler:^(id sender) {
                                                !?
      [_self showPhotoPickerView];
  } forControlEvents:UIControlEventTouchUpInside];
  [self.view addSubview:button];
Tips
ARC

 •   -fno-objc-arc
Tips
ARC

 •   Static Library

     •                 Static Library

     •                Workspace
Tips

 •   ARC

 •   iOS 5       __weak

 •   Blocks

     •   UI

     •   UI   Blocks
GC

•   GC

    •   iOS

    •
•
    •   CPU
•   ARC

•            (   )

•   __weak

•   GC

    •
    •                (   )

•   ARC

Weitere ähnliche Inhalte

Was ist angesagt?

ISUCONアプリを Pythonで書いてみた
ISUCONアプリを Pythonで書いてみたISUCONアプリを Pythonで書いてみた
ISUCONアプリを Pythonで書いてみたmemememomo
 
Modernizes your objective C - Oliviero
Modernizes your objective C - OlivieroModernizes your objective C - Oliviero
Modernizes your objective C - OlivieroCodemotion
 
Drush - use full power - DrupalCamp Donetsk 2014
Drush - use full power - DrupalCamp Donetsk 2014Drush - use full power - DrupalCamp Donetsk 2014
Drush - use full power - DrupalCamp Donetsk 2014Alex S
 
Modernize your Objective-C
Modernize your Objective-CModernize your Objective-C
Modernize your Objective-CMassimo Oliviero
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web DevelopmentCheng-Yi Yu
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutesSimon Willison
 
Drush. Secrets come out.
Drush. Secrets come out.Drush. Secrets come out.
Drush. Secrets come out.Alex S
 
JS Level Up: Prototypes
JS Level Up: PrototypesJS Level Up: Prototypes
JS Level Up: PrototypesVernon Kesner
 
MongoDB: tips, trick and hacks
MongoDB: tips, trick and hacksMongoDB: tips, trick and hacks
MongoDB: tips, trick and hacksScott Hernandez
 
Hacking Mac OSX Cocoa API from Perl
Hacking Mac OSX Cocoa API from PerlHacking Mac OSX Cocoa API from Perl
Hacking Mac OSX Cocoa API from Perltypester
 
Automatic Reference Counting
Automatic Reference CountingAutomatic Reference Counting
Automatic Reference CountingGiuseppe Arici
 

Was ist angesagt? (20)

ISUCONアプリを Pythonで書いてみた
ISUCONアプリを Pythonで書いてみたISUCONアプリを Pythonで書いてみた
ISUCONアプリを Pythonで書いてみた
 
Modernizes your objective C - Oliviero
Modernizes your objective C - OlivieroModernizes your objective C - Oliviero
Modernizes your objective C - Oliviero
 
Scala active record
Scala active recordScala active record
Scala active record
 
Drush - use full power - DrupalCamp Donetsk 2014
Drush - use full power - DrupalCamp Donetsk 2014Drush - use full power - DrupalCamp Donetsk 2014
Drush - use full power - DrupalCamp Donetsk 2014
 
ES6: Features + Rails
ES6: Features + RailsES6: Features + Rails
ES6: Features + Rails
 
Nubilus Perl
Nubilus PerlNubilus Perl
Nubilus Perl
 
Modernize your Objective-C
Modernize your Objective-CModernize your Objective-C
Modernize your Objective-C
 
Play á la Rails
Play á la RailsPlay á la Rails
Play á la Rails
 
dotCloud and go
dotCloud and godotCloud and go
dotCloud and go
 
Perl Web Client
Perl Web ClientPerl Web Client
Perl Web Client
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
 
I os 04
I os 04I os 04
I os 04
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
Drush. Secrets come out.
Drush. Secrets come out.Drush. Secrets come out.
Drush. Secrets come out.
 
JS Level Up: Prototypes
JS Level Up: PrototypesJS Level Up: Prototypes
JS Level Up: Prototypes
 
MongoDB: tips, trick and hacks
MongoDB: tips, trick and hacksMongoDB: tips, trick and hacks
MongoDB: tips, trick and hacks
 
Hacking Mac OSX Cocoa API from Perl
Hacking Mac OSX Cocoa API from PerlHacking Mac OSX Cocoa API from Perl
Hacking Mac OSX Cocoa API from Perl
 
XQuery Rocks
XQuery RocksXQuery Rocks
XQuery Rocks
 
ES6 is Nigh
ES6 is NighES6 is Nigh
ES6 is Nigh
 
Automatic Reference Counting
Automatic Reference CountingAutomatic Reference Counting
Automatic Reference Counting
 

Andere mochten auch

Core Graphicsでつくる自作UIコンポーネント入門
Core Graphicsでつくる自作UIコンポーネント入門Core Graphicsでつくる自作UIコンポーネント入門
Core Graphicsでつくる自作UIコンポーネント入門cocopon
 
Amazon ec2とは何か?
Amazon ec2とは何か?Amazon ec2とは何か?
Amazon ec2とは何か?Shinya_131
 
Herokuで作るdevise認証サイト
Herokuで作るdevise認証サイトHerokuで作るdevise認証サイト
Herokuで作るdevise認証サイトFukui Osamu
 
120529 railsとか勉強会v2
120529 railsとか勉強会v2120529 railsとか勉強会v2
120529 railsとか勉強会v2Yoshiteru Toki
 
Memory management in Objective C
Memory management in Objective CMemory management in Objective C
Memory management in Objective CNeha Gupta
 
Memory management in Andoid
Memory management in AndoidMemory management in Andoid
Memory management in AndoidMonkop Inc
 
いまさら聞けないUnity小技
いまさら聞けないUnity小技いまさら聞けないUnity小技
いまさら聞けないUnity小技Yuichi Ishii
 
Apple iOS - A modern way to mobile operating system
Apple iOS - A modern way to mobile operating systemApple iOS - A modern way to mobile operating system
Apple iOS - A modern way to mobile operating systemDhruv Patel
 
Unity5.3の機能まとめ
Unity5.3の機能まとめUnity5.3の機能まとめ
Unity5.3の機能まとめKeigo Ando
 

Andere mochten auch (15)

Air printで遊んでみた
Air printで遊んでみたAir printで遊んでみた
Air printで遊んでみた
 
Sencha study
Sencha studySencha study
Sencha study
 
Core Graphicsでつくる自作UIコンポーネント入門
Core Graphicsでつくる自作UIコンポーネント入門Core Graphicsでつくる自作UIコンポーネント入門
Core Graphicsでつくる自作UIコンポーネント入門
 
mq 使ってみたよ
mq 使ってみたよmq 使ってみたよ
mq 使ってみたよ
 
vImageのススメ
vImageのススメvImageのススメ
vImageのススメ
 
Amazon ec2とは何か?
Amazon ec2とは何か?Amazon ec2とは何か?
Amazon ec2とは何か?
 
Herokuで作るdevise認証サイト
Herokuで作るdevise認証サイトHerokuで作るdevise認証サイト
Herokuで作るdevise認証サイト
 
120529 railsとか勉強会v2
120529 railsとか勉強会v2120529 railsとか勉強会v2
120529 railsとか勉強会v2
 
Memory management in Objective C
Memory management in Objective CMemory management in Objective C
Memory management in Objective C
 
Android & IOS
Android & IOSAndroid & IOS
Android & IOS
 
iOS Memory Management
iOS Memory ManagementiOS Memory Management
iOS Memory Management
 
Memory management in Andoid
Memory management in AndoidMemory management in Andoid
Memory management in Andoid
 
いまさら聞けないUnity小技
いまさら聞けないUnity小技いまさら聞けないUnity小技
いまさら聞けないUnity小技
 
Apple iOS - A modern way to mobile operating system
Apple iOS - A modern way to mobile operating systemApple iOS - A modern way to mobile operating system
Apple iOS - A modern way to mobile operating system
 
Unity5.3の機能まとめ
Unity5.3の機能まとめUnity5.3の機能まとめ
Unity5.3の機能まとめ
 

Ähnlich wie ARCでめちゃモテiOSプログラマー

Objective-C Survives
Objective-C SurvivesObjective-C Survives
Objective-C SurvivesS Akai
 
MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOSPetr Dvorak
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsPetr Dvorak
 
Developing iOS REST Applications
Developing iOS REST ApplicationsDeveloping iOS REST Applications
Developing iOS REST Applicationslmrei
 
iPhone dev intro
iPhone dev introiPhone dev intro
iPhone dev introVonbo
 
Beginning to iPhone development
Beginning to iPhone developmentBeginning to iPhone development
Beginning to iPhone developmentVonbo
 
I phoneアプリの通信エラー処理
I phoneアプリの通信エラー処理I phoneアプリの通信エラー処理
I phoneアプリの通信エラー処理Satoshi Asano
 
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Sarp Erdag
 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone DevelopmentGiordano Scalzo
 
iPhone Memory Management
iPhone Memory ManagementiPhone Memory Management
iPhone Memory ManagementVadim Zimin
 
Arc of developer part1
Arc of developer part1Arc of developer part1
Arc of developer part1Junpei Wada
 
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみたスマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみたTaro Matsuzawa
 
Using Protocol to Refactor
Using Protocol to Refactor Using Protocol to Refactor
Using Protocol to Refactor Green Chiu
 
Introduction to Objective - C
Introduction to Objective - CIntroduction to Objective - C
Introduction to Objective - CJussi Pohjolainen
 
Freebase and the iPhone
Freebase and the iPhoneFreebase and the iPhone
Freebase and the iPhoneAlec Flett
 
Beginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCABeginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCAWhymca
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)Katsumi Kishikawa
 

Ähnlich wie ARCでめちゃモテiOSプログラマー (20)

Objective-C Survives
Objective-C SurvivesObjective-C Survives
Objective-C Survives
 
MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOS
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS Basics
 
Developing iOS REST Applications
Developing iOS REST ApplicationsDeveloping iOS REST Applications
Developing iOS REST Applications
 
Leaks & Zombies
Leaks & ZombiesLeaks & Zombies
Leaks & Zombies
 
iPhone dev intro
iPhone dev introiPhone dev intro
iPhone dev intro
 
Beginning to iPhone development
Beginning to iPhone developmentBeginning to iPhone development
Beginning to iPhone development
 
Objective C Memory Management
Objective C Memory ManagementObjective C Memory Management
Objective C Memory Management
 
I phoneアプリの通信エラー処理
I phoneアプリの通信エラー処理I phoneアプリの通信エラー処理
I phoneアプリの通信エラー処理
 
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone Development
 
iPhone Memory Management
iPhone Memory ManagementiPhone Memory Management
iPhone Memory Management
 
Arc of developer part1
Arc of developer part1Arc of developer part1
Arc of developer part1
 
Iphone course 1
Iphone course 1Iphone course 1
Iphone course 1
 
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみたスマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた
 
Using Protocol to Refactor
Using Protocol to Refactor Using Protocol to Refactor
Using Protocol to Refactor
 
Introduction to Objective - C
Introduction to Objective - CIntroduction to Objective - C
Introduction to Objective - C
 
Freebase and the iPhone
Freebase and the iPhoneFreebase and the iPhone
Freebase and the iPhone
 
Beginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCABeginning icloud development - Cesare Rocchi - WhyMCA
Beginning icloud development - Cesare Rocchi - WhyMCA
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)
 

Mehr von Satoshi Asano

GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法
GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法
GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法Satoshi Asano
 
iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜
iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜
iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜Satoshi Asano
 
Google Analytics & iPhone
Google Analytics & iPhoneGoogle Analytics & iPhone
Google Analytics & iPhoneSatoshi Asano
 
iPhoneアプリ開発講座Web連携アプリ編
iPhoneアプリ開発講座Web連携アプリ編iPhoneアプリ開発講座Web連携アプリ編
iPhoneアプリ開発講座Web連携アプリ編Satoshi Asano
 
Asihttp requestについて
Asihttp requestについてAsihttp requestについて
Asihttp requestについてSatoshi Asano
 
バックグラウンド位置取得について
バックグラウンド位置取得についてバックグラウンド位置取得について
バックグラウンド位置取得についてSatoshi Asano
 
iPhoneアプリ開発講座入門編
iPhoneアプリ開発講座入門編iPhoneアプリ開発講座入門編
iPhoneアプリ開発講座入門編Satoshi Asano
 
集合知プログラミング第2章復習
集合知プログラミング第2章復習集合知プログラミング第2章復習
集合知プログラミング第2章復習Satoshi Asano
 
Algorithm Introduction #18 B-Tree
Algorithm Introduction #18 B-TreeAlgorithm Introduction #18 B-Tree
Algorithm Introduction #18 B-TreeSatoshi Asano
 

Mehr von Satoshi Asano (9)

GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法
GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法
GitHub活動を通して個人のキャリアを積みつつ仕事の成果を出す方法
 
iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜
iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜
iPhoneアプリとAndroidアプリを比較する〜はてなブックマーク開発の現場から〜
 
Google Analytics & iPhone
Google Analytics & iPhoneGoogle Analytics & iPhone
Google Analytics & iPhone
 
iPhoneアプリ開発講座Web連携アプリ編
iPhoneアプリ開発講座Web連携アプリ編iPhoneアプリ開発講座Web連携アプリ編
iPhoneアプリ開発講座Web連携アプリ編
 
Asihttp requestについて
Asihttp requestについてAsihttp requestについて
Asihttp requestについて
 
バックグラウンド位置取得について
バックグラウンド位置取得についてバックグラウンド位置取得について
バックグラウンド位置取得について
 
iPhoneアプリ開発講座入門編
iPhoneアプリ開発講座入門編iPhoneアプリ開発講座入門編
iPhoneアプリ開発講座入門編
 
集合知プログラミング第2章復習
集合知プログラミング第2章復習集合知プログラミング第2章復習
集合知プログラミング第2章復習
 
Algorithm Introduction #18 B-Tree
Algorithm Introduction #18 B-TreeAlgorithm Introduction #18 B-Tree
Algorithm Introduction #18 B-Tree
 

Kürzlich hochgeladen

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Kürzlich hochgeladen (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

ARCでめちゃモテiOSプログラマー

  • 1. ARC iOS (id:ninjinkun / @ninjinkun)
  • 2. Cocoa Touch • ARC • ARC • • ARC • • Tips • GC
  • 3. Cocoa Touch • retain / relase -(void)setName:(NSString *)newName { name = [newName retain]; } -(void)dealloc { [name release]; [super dealloc]; 1 3 0 } • Ownership • Ownership retain • Ownership release • 0
  • 4. Cocoa Touch Autorelase • • autorelease • release • / •
  • 5. Cocoa Touch Autorelase • • autorelease • release • / • -(void)buildNewName { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSMutableArray *array = [[[NSMutableArray alloc] init] autorelease]; [array addObject:@"hoge"]; [array addObject:@"fuga"]; [array addObject:@"piyo"]; name =[array componentsJoinedByString:@","]; [pool drain]; }
  • 6. ARC • Automatic Reference Counting • • iOS 5 / Mac OS X 10.7
  • 7. ARC • • • (GC) • Static Analyzer
  • 8. ARC • @interface NonARCObject : NSObject { NSString *name; } -(id)initWithName:(NSString *)name; @end @implementation NonARCObject -(id)initWithName:(NSString *)newName { self = [super init]; if (self) { name = [newName retain]; } return self; } -(void)dealloc { [name release]; [super dealloc]; } @end
  • 9. ARC • @interface ARCObject : NSObject { NSString *name; } -(id)initWithName:(NSString *)name; @end @implementation ARCObject -(id)initWithName:(NSString *)newName { self = [super init]; if (self) { name = newName; } return self; } @end
  • 10. ARC ARC • • … • • • •
  • 11. ARC __strong • • Ownership • • retain, release -(void)buildNewName { { __strong NSMutableArray *array = [[NSMutableArray alloc] init]; [array addObject:@"hoge"]; [array addObject:@"fuga"]; [array addObject:@"piyo"]; name =[array componentsJoinedByString:@","]; } } !
  • 12. ARC __strong • • retain, dealloc relase @interface ARCUser : NSObject { __strong NSString *name; } @end @implementation ARCUser -(id)initWithName:(NSString *)newName { self = [super init]; if (self) { name = newName; // [newName retain] } return self; } -(void)dealloc { // [name release] } @end
  • 13. ARC __weak • __weak • • Ownership • nil • • iOS 5 @interface ARCUser : NSObject { __weak id delegate; } @end
  • 14. ARC __unsafe_unretainded • • assign • • iOS 4.3 @interface ARCUser : NSObject { __unsafe_unretained id delegate; } @end
  • 15. ARC __autoreleasing • autorelase • • @autorelasepool { } -(NSArray *)comvertImageToJpeg:(NSArray *)files { NSMutableArray *dataStore = [NSMutableArray array]; @autoreleasepool { for (NSString *filePath in files) { __autoreleasing UIImage *image = [[UIImage alloc] initWithContentsOfFile:filePath]; NSData *data = UIImageJPEGRepresentation(image, 1.0); [dataStore addObject:data]; } } return [dataStore copy]; }
  • 16. ARC • retain, release, autorelase • retainCount • [super dealloc] • dealloc -(void)dealloc { delegate = nil; } • C __bridge NSString *str = @"hogehoge"; CFStringRef strRef = (__bridge CFStringRef)str; CFStringRef strRef = (__bridge_retained CFStringRef)str;
  • 17. ARC __strong • __strong __strong __strong __strong __strong __strong
  • 18. iOS 5 __weak • iOS 4.3 __unsafe_unretaind • nil __strong __weak __strong __strong __strong
  • 20. ARC retain / relase • -S • • _objc_release() • _objc_retain() • _objc_retainAutoreleasedReturnValue()
  • 21. ARC __weak • _objc_storeWeak() • 0 _objc_destroyWeak() • • nil • This document is licensed to ninjin@mac.com.
  • 22. Blocks • ARC • self ? • • release • BlocksKit UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button addEventHandler:^(id sender) { [self showPhotoPickerView]; } forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button];
  • 23. Blocks • UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; __unsafe_unretained id _self = self; // !? [button addEventHandler:^(id sender) { [_self showPhotoPickerView]; } forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button];
  • 24. Blocks • UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; __unsafe_unretained id _self = self; // !? [button addEventHandler:^(id sender) { !? [_self showPhotoPickerView]; } forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button];
  • 25. Tips ARC • -fno-objc-arc
  • 26. Tips ARC • Static Library • Static Library • Workspace
  • 27. Tips • ARC • iOS 5 __weak • Blocks • UI • UI Blocks
  • 28. GC • GC • iOS • • • CPU
  • 29. ARC • ( ) • __weak • GC • • ( ) • ARC