SlideShare ist ein Scribd-Unternehmen logo
1 von 61
iOS 5 New Stuff
                  R.Ayu Maulidina.I.
Over 200 new user features
SDK & Development tools?
over 1,500 new APIs and powerful new development tools
iCloud Storage API

     Apa itu iCloud?
 - Sync service
 - Transfers user data between devices
 - Runs in background
 - Per-app sandboxing (as usual)



 Keuntungannya Apa ?

- Gak perlu ‘sync server’ sendiri.
- Gak perlu ‘network protocol’ sendiri.
- Gak perlu bayar ‘storage/bandwidth’ sendiri.

      Intinya sih gak perlu repot-repot.
Konsep dan Ketentuan iCloud



                    Ubiquitous


Suatu keadaan yang memungkinkan manusia untuk berinteraksi dengan
       ‘komputer’ dimana saja, kapan saja dan bagaimana saja.
Sinkronisasi Background



Ubiquity daemon, ubd

Saat anda menyimpan perubahan, ubd mengirimkannya pada ‘cloud’

ubd akan mengunduhnya dari iCloud

Dimana itu berarti....
Data anda dapat berubah tanpa
         peringatan..
iCloud Containers


Lokasi untuk data aplikasi anda berada di iCloud
Setiap pengaktifan iCloud pada aplikasi setidaknya hanya
memiliki satu tempat.
Kontainer sesuai dengan direktori yang kita buat
File Coordinator


Data dapat diubah oleh aplikasi anda atau oleh ubd
(Ubiquity Daemon)
Membutuhkan ‘reader/writer lock’ untuk akses koordinasi
Menggunakan ‘NSFileCoordinator’ saat menulis atau
membacanya
File Presenter

Disertakan juga pada file koordinator
Menerapkan ‘NSFilePresenter’ agar mendapat
pemberitahuan akan adanya perubahan
Saat file koordinator membuat perubahan, maka ‘file
presenter’ ini akan dipanggil.
iCloud APIs



Key-value store
Core Data
Document
Gimana cara mengaktifkan
        iCloud ?
App ID on Provisioning Portal --->
developer.apple.com/ios/ ---> app IDs
Konfigurasi app ID
Peringatan!
Configuration name for identifier, entitlements
 file, iCloud key-value store, containers and
           keychain access groups.
Entitlements Setting
Ubiquitous Documents
UIDocument




Asynchronous block-based reading and writing

Auto-saving

Flat file and file packages
UIDocument with iCloud



Acts as a file coordinator and presenter

Mendeteksi conflicts

- Notifications
- API to help resolve
UIDocument Concepts



  Outside the (sand)box
- iCloud documents are not located in your app sandbox
- Located in your iCloud container
- Create the document in the sandbox
- Move it to iCloud
Document State


UIDocumentStateNormal

UIDocumentStateClosed

UIDocumentStateInConflict

UIDocumentStateSavingError

UIDocumentStateEditingDisabled

UIDocumentStateChangedNotification
Demo Code: CloudNotes
Subclassing UIDocument




@interface NoteDocument : UIDocument
@property (strong, readwrite) NSString *documentText;
@end
Subclassing UIDocument




- (BOOL)loadFromContents:(id)contents ofType:(NSString
*)typeName error:(NSError *__autoreleasing *)outError;
- (id)contentsForType:(NSString *)typeName error:(NSError
*__autoreleasing *)outError;
- (BOOL)loadFromContents:(id)contents ofType:(NSString
*)typeName error:(NSError *__autoreleasing *)outError
{

  NSString *text = nil;
  if ([contents length] > 0) {
    text = [[NSString alloc] initWithBytes:[contents bytes]
    length:[contents length] encoding:NSUTF8StringEncoding];
  } else {
    text = @"";
  }

}
[self setDocumentText:text];
return YES;
- (id)contentsForType:(NSString *)typeName error:(NSError
*__autoreleasing *)outError {

    if ([[self documentText] length] == 0) {
    [self setDocumentText:@"New note"];
    }
    return [NSData dataWithBytes:[[self documentText]
    UTF8String] length:[[self documentText] length]];
}
Creating a NoteDocument
- (NSURL*)ubiquitousDocumentsDirectoryURL
{
    NSURL *ubiquitousContainerURL = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];

    NSURL *ubiquitousDocumentsURL = [ubiquitousContainerURL URLByAppendingPathComponent:@"Documents"];

    if (ubiquitousDocumentsURL != nil) {
        if (![[NSFileManager defaultManager] fileExistsAtPath:[ubiquitousDocumentsURL path]]) {
             NSError *createDirectoryError = nil;
             BOOL created = [[NSFileManager defaultManager] createDirectoryAtURL:ubiquitousDocumentsURL
                 withIntermediateDirectories:YES
                 attributes:0
                 error:&createDirectoryError];
             if (!created) {
                 NSLog(@"Error creating directory at %@: %@", ubiquitousDocumentsURL, createDirectoryError);
             }
        }
    } else {
        NSLog(@"Error getting ubiquitous container URL");
    }
    return ubiquitousDocumentsURL;
}
- (NSURL*)ubiquitousDocumentsDirectoryURL
{
    NSURL *ubiquitousContainerURL = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil];

    NSURL *ubiquitousDocumentsURL = [ubiquitousContainerURL URLByAppendingPathComponent:@"Documents"];

    if (ubiquitousDocumentsURL != nil) {
        if (![[NSFileManager defaultManager] fileExistsAtPath:[ubiquitousDocumentsURL path]]) {
             NSError *createDirectoryError = nil;
             BOOL created = [[NSFileManager defaultManager] createDirectoryAtURL:ubiquitousDocumentsURL
                 withIntermediateDirectories:YES
                 attributes:0
                 error:&createDirectoryError];
             if (!created) {
                 NSLog(@"Error creating directory at %@: %@", ubiquitousDocumentsURL, createDirectoryError);
             }
        }
    } else {
        NSLog(@"Error getting ubiquitous container URL");
    }
    return ubiquitousDocumentsURL;
}
- (void)createFileNamed:(NSString *)filename
{
    NSURL *localFileURL = [[self localDocumentsDirectoryURL] URLByAppendingPathComponent:filename];

    NoteDocument *newDocument = [[NoteDocument alloc] initWithFileURL:localFileURL];

    [newDocument saveToURL:localFileURL
        forSaveOperation:UIDocumentSaveForCreating
        completionHandler:^(BOOL success) {

          if (success) {
             dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

                    NSURL *destinationURL = [[self ubiquitousDocumentsDirectoryURL]
                        URLByAppendingPathComponent:filename];

                    NSError *moveToCloudError = nil;
                    BOOL success = [[NSFileManager defaultManager]
                        setUbiquitous:YES
                        itemAtURL:[newDocument fileURL]
                        destinationURL:destinationURL
                        error:&moveToCloudError];

                    if (!success) {
                        NSLog(@"Error moving to iCloud: %@", moveToCloudError);
                    }
              });
          }
    }];
}
- (void)createFileNamed:(NSString *)filename
{
    NSURL *localFileURL = [[self localDocumentsDirectoryURL] URLByAppendingPathComponent:filename];

    NoteDocument *newDocument = [[NoteDocument alloc] initWithFileURL:localFileURL];

    [newDocument saveToURL:localFileURL
        forSaveOperation:UIDocumentSaveForCreating
        completionHandler:^(BOOL success) {

          if (success) {
             dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

                    NSURL *destinationURL = [[self ubiquitousDocumentsDirectoryURL]
                        URLByAppendingPathComponent:filename];

                    NSError *moveToCloudError = nil;
                    BOOL success = [[NSFileManager defaultManager]
                        setUbiquitous:YES
                        itemAtURL:[newDocument fileURL]
                        destinationURL:destinationURL
                        error:&moveToCloudError];

                    if (!success) {
                        NSLog(@"Error moving to iCloud: %@", moveToCloudError);
                    }
              });
          }
    }];
}
- (void)createFileNamed:(NSString *)filename
{
    NSURL *localFileURL = [[self localDocumentsDirectoryURL] URLByAppendingPathComponent:filename];

    NoteDocument *newDocument = [[NoteDocument alloc] initWithFileURL:localFileURL];

    [newDocument saveToURL:localFileURL
        forSaveOperation:UIDocumentSaveForCreating
        completionHandler:^(BOOL success) {

          if (success) {
             dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

                    NSURL *destinationURL = [[self ubiquitousDocumentsDirectoryURL]
                        URLByAppendingPathComponent:filename];

                    NSError *moveToCloudError = nil;
                    BOOL success = [[NSFileManager defaultManager]
                        setUbiquitous:YES
                        itemAtURL:[newDocument fileURL]
                        destinationURL:destinationURL
                        error:&moveToCloudError];

                    if (!success) {
                        NSLog(@"Error moving to iCloud: %@", moveToCloudError);
                    }
              });
          }
    }];
}
Create new document
Core Image
image processing technology

memungkinkan proses mendekati real-time

menyediakan akses untuk ‘built-in image filters’ pada
video and gambar

menyediakan juga fitur untuk membuat ‘custom filters’
Class References


1.CIColor
2.CIContext
3.CIDetector
4.CIFaceFeature
5.CIFeature
6.CIFilter
7.CIImage
8.CIVector
Face Detection
CIFaceFeature

    Facial Features

•     hasLeftEyePosition  property
•     hasRightEyePosition  property
•     hasMouthPosition  property
•     leftEyePosition  property
•     rightEyePosition  property
•     mouthPosition  property
Demo Code: Easy Face Detection
// we'll iterate through every detected face. CIFaceFeature provides us
    // with the width for the entire face, and the coordinates of each eye
    // and the mouth if detected. Also provided are BOOL's for the eye's and
    // mouth so we can check if they already exist.
    for(CIFaceFeature* faceFeature in features)
    {
        // get the width of the face
        CGFloat faceWidth = faceFeature.bounds.size.width;

        // create a UIView using the bounds of the face
        UIView* faceView = [[UIView alloc] initWithFrame:faceFeature.bounds];

        // add a border around the newly created UIView
        faceView.layer.borderWidth = 1;
        faceView.layer.borderColor = [[UIColor redColor] CGColor];

        // add the new view to create a box around the face
        [self.window addSubview:faceView];

        if(faceFeature.hasLeftEyePosition)
        {
            // create a UIView with a size based on the width of the face
            UIView* leftEyeView = [[UIView alloc] initWithFrame:CGRectMake(faceFeature.leftEyePosition.x-faceWidth*0.15,
faceFeature.leftEyePosition.y-faceWidth*0.15, faceWidth*0.3, faceWidth*0.3)];
            // change the background color of the eye view
            [leftEyeView setBackgroundColor:[[UIColor blueColor] colorWithAlphaComponent:0.3]];
            // set the position of the leftEyeView based on the face
            [leftEyeView setCenter:faceFeature.leftEyePosition];
            // round the corners
            leftEyeView.layer.cornerRadius = faceWidth*0.15;
            // add the view to the window
            [self.window addSubview:leftEyeView];
        }

        if(faceFeature.hasRightEyePosition)
        {
            // create a UIView with a size based on the width of the face
            UIView* leftEye = [[UIView alloc] initWithFrame:CGRectMake(faceFeature.rightEyePosition.x-faceWidth*0.15,
faceFeature.rightEyePosition.y-faceWidth*0.15, faceWidth*0.3, faceWidth*0.3)];
            // change the background color of the eye view
            [leftEye setBackgroundColor:[[UIColor blueColor] colorWithAlphaComponent:0.3]];
            // set the position of the rightEyeView based on the face
            [leftEye setCenter:faceFeature.rightEyePosition];
            // round the corners
            leftEye.layer.cornerRadius = faceWidth*0.15;
            // add the new view to the window
            [self.window addSubview:leftEye];
        }
Detector Option Keys

Keys used in the options dictionary to configure a detector.


Detector Accuracy Options
NSString* const CIDetectorAccuracyLow;
NSString* const CIDetectorAccuracyHigh;

- CIDetectorAccuracyLow
Indicates that the detector should choose techniques that are lower in accuracy, but can be
processed more quickly.
- CIDetectorAccuracyHigh
Indicates that the detector should choose techniques that are higher in accuracy, even if it
requires more processing time.
Real-time Example by Erica
          Sadun
Newsstand
Newsstand for developer

Simpel dan mudah digunakan untuk konten majalah
dan surat kabar
Termasuk gratis berlangganan untuk pengguna iPhone,
iPod touch dan iPad
Menerbitkan edisi terbaru majalah dan surat kabar
langsung menggunakan Newsstand kit dan Store kit
framework
NewsstandKit



Push notification
updates
Content organization
Background
downloads
Menampilkan pada Newsstand
Menjadikan Newsstand app



  Menambahkan satu key dalam file
  Info.plist
     <key>UINewsstandApp</key>

     <true/>


  Yak jadilah Newsstand app!

  Tapi masih butuh icon nih.
Menampilkan pada Newsstand
Standard icon specification
                          Standard icon specification
                          • Top-level key in your Info.plist with an array of image name


                                                <key>CFBundleIconFiles</key>
  Key pada level paling atas di file             <array>
  Info.plist berisi array nama dari image
                                                ! <string>Icon.png</string>
                                                ! <string>Icon@2x.png</string>
                                                 ...
                                                </array>
Menampilkan pada Newsstand
Updating your Info.plist
    Updating your Info.plist

                              <key>CFBundleIcons</key>
                                                                  New top-level key
                              <dict>
                               <key>CFBundlePrimaryIcon</key>
             Icon style key
                               <dict>
                                 <key>CFBundleIconFiles</key>
                                 <array>
 Existing CFBundleIconFiles        <string>Icon.png</string>
                                   <string>Icon@2x.png</string>
                                 </array>

                               </dict>
                              </dict>
Newsstand info-plist
Handling Updates
Retrieving and presenting content




                     Retrieving and presenting content


  Informing theInforming the app
              • app                                         INFORMING
                     • Organizing issues
  Organizing        issues content
                     • Downloading
                                                UPDATING                 ORGANIZING
                     • Updating your icon
  Downloading content                                      DOWNLOADING



  Updating your icon

                                                                                      27
Informing the App
Push notifications
Informing the App
Newsstand Push Notifications
Informing the App
Newsstand Push Notifications
Organizing Issues
Using NKLibrary




  • Provides persistent state for :
 ■ Available issues
 ■ Ongoing downloads
 ■ Issue being read

!
• Organizes issues
  ■ Uses app’s Caches directory
  ■ Improves resource management
Organizing Issues
NKIssues




   • Creating issues

  ■ Penamaan yang unik

  ■ Tanggal publikasi
 NKIssue *myIssue = [myLibrary addIssueWithName:issueName date:issueDate];



 ■ Mengolah repository di dalam ‘library’
 NSURL *baseURL = [myIssue contentURL];



• Setting the current issue

[myLibrary setCurrentlyReadingIssue:myIssue];
Handling Updates
Downloading content


Downloading Content
NKAssetDownload




     • Handles data transfer
 ■   Keeps going

• Uses NSURLConnectionDelegate

• Wake for critical events
 newsstand-content



• Wi-Fi only in background
Downloading Content
Setup




    NSArray *itemsToDownload = !! query server for list of assets

    for (item in itemsToDownload) {
       NSURLRequest *downloadRequest = [item URLRequest];
       NKAssetDownload *asset = [issue addAssetWithRequest:downloadRequest];
       NSURLConnection *connection = [asset downloadWithDelegate:myDelegate];
    }
}
Downloading Content
NSURLConnectionDownloadDelegate




   [asset downloadWithDelegate:myDelegate];


• Implements NSURLConnectionDelegate
   ■ Status
   ■ Authentication
   ■ Completion

• Modifications
-connection:didWriteData:totalBytesWritten:expectedTotalBytesWritten:
-connectionDidResumeDownloading:totalBytesWritten:expectedTotalBytesWritten:
-connectionDidFinishDownloading:destinationURL: ---> required
Updating Your Newsstand Icon
  Update your icon and badge




   Simple!

   Update Icon
-[UIApplication setNewsstandIconImage:(UIImage*)]
• Bisa digunakan saat berjalan di background, jadi bisa diupdate kapanpun jika konten sudah siap.

  Update Badge

• Uses existing badge API
-[UIApplication setApplicationIconBadgeNumber:(NSInteger)]
Demo
Creating a Newsstand App
See you...

Weitere ähnliche Inhalte

Was ist angesagt?

iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative versionWO Community
 
Third Party Auth in WebObjects
Third Party Auth in WebObjectsThird Party Auth in WebObjects
Third Party Auth in WebObjectsWO Community
 
ARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマーARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマーSatoshi Asano
 
Better Data Persistence on Android
Better Data Persistence on AndroidBetter Data Persistence on Android
Better Data Persistence on AndroidEric Maxwell
 
Local Authentication par Pierre-Alban Toth
Local Authentication par Pierre-Alban TothLocal Authentication par Pierre-Alban Toth
Local Authentication par Pierre-Alban TothCocoaHeads France
 
Adventures in Multithreaded Core Data
Adventures in Multithreaded Core DataAdventures in Multithreaded Core Data
Adventures in Multithreaded Core DataInferis
 
Parse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & TricksParse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & TricksHector Ramos
 
Softshake - Offline applications
Softshake - Offline applicationsSoftshake - Offline applications
Softshake - Offline applicationsjeromevdl
 
OpenStack Horizon: Controlling the Cloud using Django
OpenStack Horizon: Controlling the Cloud using DjangoOpenStack Horizon: Controlling the Cloud using Django
OpenStack Horizon: Controlling the Cloud using DjangoDavid Lapsley
 
Deploy Mediawiki Using FIWARE Lab Facilities
Deploy Mediawiki Using FIWARE Lab FacilitiesDeploy Mediawiki Using FIWARE Lab Facilities
Deploy Mediawiki Using FIWARE Lab FacilitiesFIWARE
 
Hidden Treasures in Project Wonder
Hidden Treasures in Project WonderHidden Treasures in Project Wonder
Hidden Treasures in Project WonderWO Community
 
async/await in Swift
async/await in Swiftasync/await in Swift
async/await in SwiftPeter Friese
 
Launching Beeline with Firebase
Launching Beeline with FirebaseLaunching Beeline with Firebase
Launching Beeline with FirebaseChetan Padia
 
JavaScript APIs - The Web is the Platform - .toster conference, Moscow
JavaScript APIs - The Web is the Platform - .toster conference, MoscowJavaScript APIs - The Web is the Platform - .toster conference, Moscow
JavaScript APIs - The Web is the Platform - .toster conference, MoscowRobert Nyman
 
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014Amazon Web Services
 

Was ist angesagt? (20)

iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative version
 
Third Party Auth in WebObjects
Third Party Auth in WebObjectsThird Party Auth in WebObjects
Third Party Auth in WebObjects
 
ARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマーARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマー
 
iCloud keychain
iCloud keychainiCloud keychain
iCloud keychain
 
Better Data Persistence on Android
Better Data Persistence on AndroidBetter Data Persistence on Android
Better Data Persistence on Android
 
Local Authentication par Pierre-Alban Toth
Local Authentication par Pierre-Alban TothLocal Authentication par Pierre-Alban Toth
Local Authentication par Pierre-Alban Toth
 
Adventures in Multithreaded Core Data
Adventures in Multithreaded Core DataAdventures in Multithreaded Core Data
Adventures in Multithreaded Core Data
 
Dockercompose
DockercomposeDockercompose
Dockercompose
 
What's Parse
What's ParseWhat's Parse
What's Parse
 
Parse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & TricksParse London Meetup - Cloud Code Tips & Tricks
Parse London Meetup - Cloud Code Tips & Tricks
 
Softshake - Offline applications
Softshake - Offline applicationsSoftshake - Offline applications
Softshake - Offline applications
 
OpenStack Horizon: Controlling the Cloud using Django
OpenStack Horizon: Controlling the Cloud using DjangoOpenStack Horizon: Controlling the Cloud using Django
OpenStack Horizon: Controlling the Cloud using Django
 
Oak Lucene Indexes
Oak Lucene IndexesOak Lucene Indexes
Oak Lucene Indexes
 
Deploy Mediawiki Using FIWARE Lab Facilities
Deploy Mediawiki Using FIWARE Lab FacilitiesDeploy Mediawiki Using FIWARE Lab Facilities
Deploy Mediawiki Using FIWARE Lab Facilities
 
Hidden Treasures in Project Wonder
Hidden Treasures in Project WonderHidden Treasures in Project Wonder
Hidden Treasures in Project Wonder
 
Intro to Parse
Intro to ParseIntro to Parse
Intro to Parse
 
async/await in Swift
async/await in Swiftasync/await in Swift
async/await in Swift
 
Launching Beeline with Firebase
Launching Beeline with FirebaseLaunching Beeline with Firebase
Launching Beeline with Firebase
 
JavaScript APIs - The Web is the Platform - .toster conference, Moscow
JavaScript APIs - The Web is the Platform - .toster conference, MoscowJavaScript APIs - The Web is the Platform - .toster conference, Moscow
JavaScript APIs - The Web is the Platform - .toster conference, Moscow
 
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
 

Andere mochten auch

iOS 5 Kick-Start @ISELTech
iOS 5 Kick-Start @ISELTechiOS 5 Kick-Start @ISELTech
iOS 5 Kick-Start @ISELTechBruno Pires
 
iOS app dev Training - Session1
iOS app dev Training - Session1iOS app dev Training - Session1
iOS app dev Training - Session1Hussain Behestee
 
iOS 5 Tech Talk World Tour 2011 draft001
iOS 5 Tech Talk World Tour 2011 draft001iOS 5 Tech Talk World Tour 2011 draft001
iOS 5 Tech Talk World Tour 2011 draft001Alexandru Terente
 
What Apple's iOS 5 Means for Marketers
What Apple's iOS 5 Means for MarketersWhat Apple's iOS 5 Means for Marketers
What Apple's iOS 5 Means for MarketersBen Gaddis
 

Andere mochten auch (8)

iOS - development
iOS - developmentiOS - development
iOS - development
 
iOS 5
iOS 5iOS 5
iOS 5
 
iOS 5 Kick-Start @ISELTech
iOS 5 Kick-Start @ISELTechiOS 5 Kick-Start @ISELTech
iOS 5 Kick-Start @ISELTech
 
iOS app dev Training - Session1
iOS app dev Training - Session1iOS app dev Training - Session1
iOS app dev Training - Session1
 
iOS 5 Tech Talk World Tour 2011 draft001
iOS 5 Tech Talk World Tour 2011 draft001iOS 5 Tech Talk World Tour 2011 draft001
iOS 5 Tech Talk World Tour 2011 draft001
 
Fwt ios 5
Fwt ios 5Fwt ios 5
Fwt ios 5
 
What Apple's iOS 5 Means for Marketers
What Apple's iOS 5 Means for MarketersWhat Apple's iOS 5 Means for Marketers
What Apple's iOS 5 Means for Marketers
 
iOS PPT
iOS PPTiOS PPT
iOS PPT
 

Ähnlich wie iOS5 NewStuff

Webエンジニアから見たiOS5
Webエンジニアから見たiOS5Webエンジニアから見たiOS5
Webエンジニアから見たiOS5Satoshi Asano
 
Developing iOS REST Applications
Developing iOS REST ApplicationsDeveloping iOS REST Applications
Developing iOS REST Applicationslmrei
 
REST/JSON/CoreData Example Code - A Tour
REST/JSON/CoreData Example Code - A TourREST/JSON/CoreData Example Code - A Tour
REST/JSON/CoreData Example Code - A TourCarl Brown
 
Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
Formacion en movilidad: Conceptos de desarrollo en iOS (IV) Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
Formacion en movilidad: Conceptos de desarrollo en iOS (IV) Mobivery
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationAbdul Malik Ikhsan
 
iOS App with Parse.com as RESTful Backend
iOS App with Parse.com as RESTful BackendiOS App with Parse.com as RESTful Backend
iOS App with Parse.com as RESTful BackendStefano Zanetti
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsPetr Dvorak
 
iOS 2 - The practical Stuff
iOS 2 - The practical StuffiOS 2 - The practical Stuff
iOS 2 - The practical StuffPetr Dvorak
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS ArchitectureEyal Vardi
 
AngularJS Internal
AngularJS InternalAngularJS Internal
AngularJS InternalEyal Vardi
 
Core Data with multiple managed object contexts
Core Data with multiple managed object contextsCore Data with multiple managed object contexts
Core Data with multiple managed object contextsMatthew Morey
 
Amazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend FrameworkAmazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend FrameworkShahar Evron
 
iOS & Drupal
iOS & DrupaliOS & Drupal
iOS & DrupalFoti Dim
 
EverNote iOS SDK introduction & practices
EverNote iOS SDK introduction & practices EverNote iOS SDK introduction & practices
EverNote iOS SDK introduction & practices MaoYang Chien
 
What's new in iOS 7
What's new in iOS 7What's new in iOS 7
What's new in iOS 7barcelonaio
 
Simpler Core Data with RubyMotion
Simpler Core Data with RubyMotionSimpler Core Data with RubyMotion
Simpler Core Data with RubyMotionStefan Haflidason
 

Ähnlich wie iOS5 NewStuff (20)

Webエンジニアから見たiOS5
Webエンジニアから見たiOS5Webエンジニアから見たiOS5
Webエンジニアから見たiOS5
 
Developing iOS REST Applications
Developing iOS REST ApplicationsDeveloping iOS REST Applications
Developing iOS REST Applications
 
20120121
2012012120120121
20120121
 
REST/JSON/CoreData Example Code - A Tour
REST/JSON/CoreData Example Code - A TourREST/JSON/CoreData Example Code - A Tour
REST/JSON/CoreData Example Code - A Tour
 
занятие8
занятие8занятие8
занятие8
 
iOS
iOSiOS
iOS
 
Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
Formacion en movilidad: Conceptos de desarrollo en iOS (IV) Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
Formacion en movilidad: Conceptos de desarrollo en iOS (IV)
 
Codeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept ImplementationCodeigniter : Two Step View - Concept Implementation
Codeigniter : Two Step View - Concept Implementation
 
iOS App with Parse.com as RESTful Backend
iOS App with Parse.com as RESTful BackendiOS App with Parse.com as RESTful Backend
iOS App with Parse.com as RESTful Backend
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS Basics
 
iOS 2 - The practical Stuff
iOS 2 - The practical StuffiOS 2 - The practical Stuff
iOS 2 - The practical Stuff
 
The IoC Hydra
The IoC HydraThe IoC Hydra
The IoC Hydra
 
AngularJS Architecture
AngularJS ArchitectureAngularJS Architecture
AngularJS Architecture
 
AngularJS Internal
AngularJS InternalAngularJS Internal
AngularJS Internal
 
Core Data with multiple managed object contexts
Core Data with multiple managed object contextsCore Data with multiple managed object contexts
Core Data with multiple managed object contexts
 
Amazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend FrameworkAmazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend Framework
 
iOS & Drupal
iOS & DrupaliOS & Drupal
iOS & Drupal
 
EverNote iOS SDK introduction & practices
EverNote iOS SDK introduction & practices EverNote iOS SDK introduction & practices
EverNote iOS SDK introduction & practices
 
What's new in iOS 7
What's new in iOS 7What's new in iOS 7
What's new in iOS 7
 
Simpler Core Data with RubyMotion
Simpler Core Data with RubyMotionSimpler Core Data with RubyMotion
Simpler Core Data with RubyMotion
 

Kürzlich hochgeladen

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Kürzlich hochgeladen (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

iOS5 NewStuff

  • 1. iOS 5 New Stuff R.Ayu Maulidina.I.
  • 2. Over 200 new user features
  • 3. SDK & Development tools? over 1,500 new APIs and powerful new development tools
  • 4. iCloud Storage API Apa itu iCloud? - Sync service - Transfers user data between devices - Runs in background - Per-app sandboxing (as usual) Keuntungannya Apa ? - Gak perlu ‘sync server’ sendiri. - Gak perlu ‘network protocol’ sendiri. - Gak perlu bayar ‘storage/bandwidth’ sendiri. Intinya sih gak perlu repot-repot.
  • 5. Konsep dan Ketentuan iCloud Ubiquitous Suatu keadaan yang memungkinkan manusia untuk berinteraksi dengan ‘komputer’ dimana saja, kapan saja dan bagaimana saja.
  • 6. Sinkronisasi Background Ubiquity daemon, ubd Saat anda menyimpan perubahan, ubd mengirimkannya pada ‘cloud’ ubd akan mengunduhnya dari iCloud Dimana itu berarti....
  • 7. Data anda dapat berubah tanpa peringatan..
  • 8. iCloud Containers Lokasi untuk data aplikasi anda berada di iCloud Setiap pengaktifan iCloud pada aplikasi setidaknya hanya memiliki satu tempat. Kontainer sesuai dengan direktori yang kita buat
  • 9. File Coordinator Data dapat diubah oleh aplikasi anda atau oleh ubd (Ubiquity Daemon) Membutuhkan ‘reader/writer lock’ untuk akses koordinasi Menggunakan ‘NSFileCoordinator’ saat menulis atau membacanya
  • 10. File Presenter Disertakan juga pada file koordinator Menerapkan ‘NSFilePresenter’ agar mendapat pemberitahuan akan adanya perubahan Saat file koordinator membuat perubahan, maka ‘file presenter’ ini akan dipanggil.
  • 12. Gimana cara mengaktifkan iCloud ? App ID on Provisioning Portal ---> developer.apple.com/ios/ ---> app IDs
  • 15. Configuration name for identifier, entitlements file, iCloud key-value store, containers and keychain access groups.
  • 18. UIDocument Asynchronous block-based reading and writing Auto-saving Flat file and file packages
  • 19. UIDocument with iCloud Acts as a file coordinator and presenter Mendeteksi conflicts - Notifications - API to help resolve
  • 20. UIDocument Concepts Outside the (sand)box - iCloud documents are not located in your app sandbox - Located in your iCloud container - Create the document in the sandbox - Move it to iCloud
  • 23. Subclassing UIDocument @interface NoteDocument : UIDocument @property (strong, readwrite) NSString *documentText; @end
  • 24. Subclassing UIDocument - (BOOL)loadFromContents:(id)contents ofType:(NSString *)typeName error:(NSError *__autoreleasing *)outError; - (id)contentsForType:(NSString *)typeName error:(NSError *__autoreleasing *)outError;
  • 25. - (BOOL)loadFromContents:(id)contents ofType:(NSString *)typeName error:(NSError *__autoreleasing *)outError { NSString *text = nil; if ([contents length] > 0) { text = [[NSString alloc] initWithBytes:[contents bytes] length:[contents length] encoding:NSUTF8StringEncoding]; } else { text = @""; } } [self setDocumentText:text]; return YES;
  • 26. - (id)contentsForType:(NSString *)typeName error:(NSError *__autoreleasing *)outError { if ([[self documentText] length] == 0) { [self setDocumentText:@"New note"]; } return [NSData dataWithBytes:[[self documentText] UTF8String] length:[[self documentText] length]]; }
  • 28. - (NSURL*)ubiquitousDocumentsDirectoryURL { NSURL *ubiquitousContainerURL = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]; NSURL *ubiquitousDocumentsURL = [ubiquitousContainerURL URLByAppendingPathComponent:@"Documents"]; if (ubiquitousDocumentsURL != nil) { if (![[NSFileManager defaultManager] fileExistsAtPath:[ubiquitousDocumentsURL path]]) { NSError *createDirectoryError = nil; BOOL created = [[NSFileManager defaultManager] createDirectoryAtURL:ubiquitousDocumentsURL withIntermediateDirectories:YES attributes:0 error:&createDirectoryError]; if (!created) { NSLog(@"Error creating directory at %@: %@", ubiquitousDocumentsURL, createDirectoryError); } } } else { NSLog(@"Error getting ubiquitous container URL"); } return ubiquitousDocumentsURL; }
  • 29. - (NSURL*)ubiquitousDocumentsDirectoryURL { NSURL *ubiquitousContainerURL = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]; NSURL *ubiquitousDocumentsURL = [ubiquitousContainerURL URLByAppendingPathComponent:@"Documents"]; if (ubiquitousDocumentsURL != nil) { if (![[NSFileManager defaultManager] fileExistsAtPath:[ubiquitousDocumentsURL path]]) { NSError *createDirectoryError = nil; BOOL created = [[NSFileManager defaultManager] createDirectoryAtURL:ubiquitousDocumentsURL withIntermediateDirectories:YES attributes:0 error:&createDirectoryError]; if (!created) { NSLog(@"Error creating directory at %@: %@", ubiquitousDocumentsURL, createDirectoryError); } } } else { NSLog(@"Error getting ubiquitous container URL"); } return ubiquitousDocumentsURL; }
  • 30. - (void)createFileNamed:(NSString *)filename { NSURL *localFileURL = [[self localDocumentsDirectoryURL] URLByAppendingPathComponent:filename]; NoteDocument *newDocument = [[NoteDocument alloc] initWithFileURL:localFileURL]; [newDocument saveToURL:localFileURL forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success) { if (success) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSURL *destinationURL = [[self ubiquitousDocumentsDirectoryURL] URLByAppendingPathComponent:filename]; NSError *moveToCloudError = nil; BOOL success = [[NSFileManager defaultManager] setUbiquitous:YES itemAtURL:[newDocument fileURL] destinationURL:destinationURL error:&moveToCloudError]; if (!success) { NSLog(@"Error moving to iCloud: %@", moveToCloudError); } }); } }]; }
  • 31. - (void)createFileNamed:(NSString *)filename { NSURL *localFileURL = [[self localDocumentsDirectoryURL] URLByAppendingPathComponent:filename]; NoteDocument *newDocument = [[NoteDocument alloc] initWithFileURL:localFileURL]; [newDocument saveToURL:localFileURL forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success) { if (success) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSURL *destinationURL = [[self ubiquitousDocumentsDirectoryURL] URLByAppendingPathComponent:filename]; NSError *moveToCloudError = nil; BOOL success = [[NSFileManager defaultManager] setUbiquitous:YES itemAtURL:[newDocument fileURL] destinationURL:destinationURL error:&moveToCloudError]; if (!success) { NSLog(@"Error moving to iCloud: %@", moveToCloudError); } }); } }]; }
  • 32. - (void)createFileNamed:(NSString *)filename { NSURL *localFileURL = [[self localDocumentsDirectoryURL] URLByAppendingPathComponent:filename]; NoteDocument *newDocument = [[NoteDocument alloc] initWithFileURL:localFileURL]; [newDocument saveToURL:localFileURL forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success) { if (success) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSURL *destinationURL = [[self ubiquitousDocumentsDirectoryURL] URLByAppendingPathComponent:filename]; NSError *moveToCloudError = nil; BOOL success = [[NSFileManager defaultManager] setUbiquitous:YES itemAtURL:[newDocument fileURL] destinationURL:destinationURL error:&moveToCloudError]; if (!success) { NSLog(@"Error moving to iCloud: %@", moveToCloudError); } }); } }]; }
  • 35. image processing technology memungkinkan proses mendekati real-time menyediakan akses untuk ‘built-in image filters’ pada video and gambar menyediakan juga fitur untuk membuat ‘custom filters’
  • 38. CIFaceFeature Facial Features •   hasLeftEyePosition  property •   hasRightEyePosition  property •   hasMouthPosition  property •   leftEyePosition  property •   rightEyePosition  property •   mouthPosition  property
  • 39. Demo Code: Easy Face Detection
  • 40. // we'll iterate through every detected face. CIFaceFeature provides us // with the width for the entire face, and the coordinates of each eye // and the mouth if detected. Also provided are BOOL's for the eye's and // mouth so we can check if they already exist. for(CIFaceFeature* faceFeature in features) { // get the width of the face CGFloat faceWidth = faceFeature.bounds.size.width; // create a UIView using the bounds of the face UIView* faceView = [[UIView alloc] initWithFrame:faceFeature.bounds]; // add a border around the newly created UIView faceView.layer.borderWidth = 1; faceView.layer.borderColor = [[UIColor redColor] CGColor]; // add the new view to create a box around the face [self.window addSubview:faceView]; if(faceFeature.hasLeftEyePosition) { // create a UIView with a size based on the width of the face UIView* leftEyeView = [[UIView alloc] initWithFrame:CGRectMake(faceFeature.leftEyePosition.x-faceWidth*0.15, faceFeature.leftEyePosition.y-faceWidth*0.15, faceWidth*0.3, faceWidth*0.3)]; // change the background color of the eye view [leftEyeView setBackgroundColor:[[UIColor blueColor] colorWithAlphaComponent:0.3]]; // set the position of the leftEyeView based on the face [leftEyeView setCenter:faceFeature.leftEyePosition]; // round the corners leftEyeView.layer.cornerRadius = faceWidth*0.15; // add the view to the window [self.window addSubview:leftEyeView]; } if(faceFeature.hasRightEyePosition) { // create a UIView with a size based on the width of the face UIView* leftEye = [[UIView alloc] initWithFrame:CGRectMake(faceFeature.rightEyePosition.x-faceWidth*0.15, faceFeature.rightEyePosition.y-faceWidth*0.15, faceWidth*0.3, faceWidth*0.3)]; // change the background color of the eye view [leftEye setBackgroundColor:[[UIColor blueColor] colorWithAlphaComponent:0.3]]; // set the position of the rightEyeView based on the face [leftEye setCenter:faceFeature.rightEyePosition]; // round the corners leftEye.layer.cornerRadius = faceWidth*0.15; // add the new view to the window [self.window addSubview:leftEye]; }
  • 41. Detector Option Keys Keys used in the options dictionary to configure a detector. Detector Accuracy Options NSString* const CIDetectorAccuracyLow; NSString* const CIDetectorAccuracyHigh; - CIDetectorAccuracyLow Indicates that the detector should choose techniques that are lower in accuracy, but can be processed more quickly. - CIDetectorAccuracyHigh Indicates that the detector should choose techniques that are higher in accuracy, even if it requires more processing time.
  • 42. Real-time Example by Erica Sadun
  • 44. Newsstand for developer Simpel dan mudah digunakan untuk konten majalah dan surat kabar Termasuk gratis berlangganan untuk pengguna iPhone, iPod touch dan iPad Menerbitkan edisi terbaru majalah dan surat kabar langsung menggunakan Newsstand kit dan Store kit framework
  • 46. Menampilkan pada Newsstand Menjadikan Newsstand app Menambahkan satu key dalam file Info.plist <key>UINewsstandApp</key> <true/> Yak jadilah Newsstand app! Tapi masih butuh icon nih.
  • 47. Menampilkan pada Newsstand Standard icon specification Standard icon specification • Top-level key in your Info.plist with an array of image name <key>CFBundleIconFiles</key> Key pada level paling atas di file <array> Info.plist berisi array nama dari image ! <string>Icon.png</string> ! <string>Icon@2x.png</string> ... </array>
  • 48. Menampilkan pada Newsstand Updating your Info.plist Updating your Info.plist <key>CFBundleIcons</key> New top-level key <dict> <key>CFBundlePrimaryIcon</key> Icon style key <dict> <key>CFBundleIconFiles</key> <array> Existing CFBundleIconFiles <string>Icon.png</string> <string>Icon@2x.png</string> </array> </dict> </dict>
  • 50. Handling Updates Retrieving and presenting content Retrieving and presenting content Informing theInforming the app • app INFORMING • Organizing issues Organizing issues content • Downloading UPDATING ORGANIZING • Updating your icon Downloading content DOWNLOADING Updating your icon 27
  • 51. Informing the App Push notifications
  • 52. Informing the App Newsstand Push Notifications
  • 53. Informing the App Newsstand Push Notifications
  • 54. Organizing Issues Using NKLibrary • Provides persistent state for : ■ Available issues ■ Ongoing downloads ■ Issue being read ! • Organizes issues ■ Uses app’s Caches directory ■ Improves resource management
  • 55. Organizing Issues NKIssues • Creating issues ■ Penamaan yang unik ■ Tanggal publikasi NKIssue *myIssue = [myLibrary addIssueWithName:issueName date:issueDate]; ■ Mengolah repository di dalam ‘library’ NSURL *baseURL = [myIssue contentURL]; • Setting the current issue [myLibrary setCurrentlyReadingIssue:myIssue];
  • 56. Handling Updates Downloading content Downloading Content NKAssetDownload • Handles data transfer ■ Keeps going • Uses NSURLConnectionDelegate • Wake for critical events newsstand-content • Wi-Fi only in background
  • 57. Downloading Content Setup NSArray *itemsToDownload = !! query server for list of assets for (item in itemsToDownload) { NSURLRequest *downloadRequest = [item URLRequest]; NKAssetDownload *asset = [issue addAssetWithRequest:downloadRequest]; NSURLConnection *connection = [asset downloadWithDelegate:myDelegate]; } }
  • 58. Downloading Content NSURLConnectionDownloadDelegate [asset downloadWithDelegate:myDelegate]; • Implements NSURLConnectionDelegate ■ Status ■ Authentication ■ Completion • Modifications -connection:didWriteData:totalBytesWritten:expectedTotalBytesWritten: -connectionDidResumeDownloading:totalBytesWritten:expectedTotalBytesWritten: -connectionDidFinishDownloading:destinationURL: ---> required
  • 59. Updating Your Newsstand Icon Update your icon and badge Simple! Update Icon -[UIApplication setNewsstandIconImage:(UIImage*)] • Bisa digunakan saat berjalan di background, jadi bisa diupdate kapanpun jika konten sudah siap. Update Badge • Uses existing badge API -[UIApplication setApplicationIconBadgeNumber:(NSInteger)]

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n