SlideShare a Scribd company logo
1 of 62
Download to read offline
Building Newsstand Apps



Session 504
Ben Nielsen
iOS Application Engineering



These are confidential sessions—please refrain from streaming, blogging, or taking pictures

                                                                                              1
2
3
4
5
2
22




     6
Newsstand
The look




            7
Newsstand
The look


            • Repository for publications

            • Richer visual experience

            • Icons reflect content

            • iTunes Store integration



                                            8
NewsstandKit


           Your App                • Push notification updates
                NewsstandKit
   UIKit            NKLibrary      • Content organization
                     NKIssue
                 NKAssetDownload

       Foundation                  • Background downloads




                                                                 9
What You’ll Learn


• Appearing in Newsstand

• Retrieving content

• Presenting content




                           10
Appearing in Newsstand


Jon Drummond
iOS Application Engineering




                              11
Appearing in Newsstand
Becoming a Newsstand app
• Add one key to your Info.plist
 <key>UINewsstandApp</key>
 <true/>

• You’re now a Newsstand app!
• But you need an icon…




                                   12
Appearing in Newsstand
Time for an icon
• One icon style in iOS 4
  ■ Home screen
  ■ Search

  ■ Settings

  ■ App switcher

  ■ Notifications




                            13
14
Appearing in Newsstand
Newsstand icons
• Distinct from standard app icons
  ■ Home screen and app switcher
• Should reflect your content
• Dynamic—can be updated after
  your app is installed
• Additional adornment for magazine
  and newspaper styles




                                      15
Appearing in Newsstand
Standard icons
• We still need them!
  ■ Settings, Search, Notifications…
• Newsstand icon must be defined in addition to the standard icon




                                                                    16
Appearing in Newsstand
Standard icon specification
• Top-level key in your Info.plist with an array of image names


                      <key>CFBundleIconFiles</key>
                      <array>
                      ! <string>Icon.png</string>
                      ! <string>Icon@2x.png</string>
                       ...
                      </array>




                                                                  17
Appearing in Newsstand
Newsstand icons
• A new top-level Info.plist key
  ■   CFBundleIcons—a dictionary of icon styles


           CFBundlePrimaryIcon                    UINewsstandIcon




                                                                    18
Appearing in Newsstand
   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>




                                                                                     19
Appearing in Newsstand
   Updating your Info.plist

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

                              </dict>
                             </dict>




                                                                                     20
Appearing in Newsstand
Customizing your Newsstand icon
• Icons are adorned to resemble their physical counterparts
  ■  Newspaper or magazine?
   ■ Binding edge


• Exist as keys inside the UINewsstandIcon style dictionary




                                                              21
Appearing in Newsstand
Customizing your Newsstand icon
 UINewsstandBindingTypeMagazine   UINewsstandBindingTypeNewspaper

                                  Stack



Staples                  Pages




                                   Fold


                   UINewsstandBindingEdgeLeft
                  UINewsstandBindingEdgeRight
                  UINewsstandBindingEdgeBottom


                                                                    22
Appearing in Newsstand
Updating your Info.plist

            <key>CFBundleIcons</key><dict>
             <key>UINewsstandIcon</key><dict>                  Newsstand style
               <key>CFBundleIconFiles</key>...</array>         key and icon files

               <key>UINewsstandBindingType</key>
               <string>UINewsstandBindingTypeNewspaper</string>
  Options
               <key>UINewsstandBindingEdge</key>
               <string>UINewsstandBindingEdgeBottom</string>
             </dict>
            </dict>




                                                                                    23
Appearing in Newsstand
Additional considerations
• Icons need not be square
  ■  Use a shape that matches your physical appearance
• You must still include CFBundlePrimaryIcon
   ■ Standard and Newsstand icon are both needed


• Backward compatibility
   ■ CFBundleIcons is required for Newsstand apps in iOS 5

   ■ Can coexist with existing icon keys for earlier versions of iOS




                                                                       24
Demo
Creating a Newsstand App




                           25
Handling Updates


Ben Nielsen
iOS Application Engineering




                              26
Handling Updates
Retrieving and presenting content


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




                                                                 27
Handling Updates
Informing the App




                    28
INFORMING




Informing the App      UPDATING                 ORGANIZING




  Push notifications
                                  DOWNLOADING




                                                             29
INFORMING




Informing the App                                                     UPDATING                 ORGANIZING




Newsstand Push Notifications
                                                                                 DOWNLOADING




• Registration Type
 UIRemoteNotificationTypeNewsstandContentAvailability

• Payload Key
 {
          ‘aps’:{
              ‘content-available’:1
          }
 }

• Once per day
     ■   NSUserDefaults:   @”NKDontThrottleNewsstandContentNotifications”



                                                                                                            30
INFORMING




Informing the App                                   UPDATING                 ORGANIZING




Newsstand Push Notifications
                                                               DOWNLOADING




• Background mode
 <key>UIBackgroundModes</key>
 <array>
     <string>newsstand-content</string>
 </array>

• Limited time
 -[UIApplication beginTaskWithExpirationHandler:]




                                                                                          31
Handling Updates
Organizing issues




                    32
INFORMING




Organizing Issues                   UPDATING                 ORGANIZING




Using NKLibrary
                                               DOWNLOADING




• Provides persistent state for:
  ■  Available issues
   ■ Ongoing downloads

   ■ Issue being read


• Organizes issues
   ■ Uses app’s Caches directory

   ■ Improves resource management




                                                                          33
INFORMING




Organizing Issues                                              UPDATING                 ORGANIZING




NKIssues
                                                                          DOWNLOADING




• Creating issues
  ■ Unique name
  ■ Publication date

 NKIssue *myIssue = [myLibrary addIssueWithName:issueName date:issueDate];
  ■   Maintains a repository within the library
 NSURL *baseURL = [myIssue contentURL];

• Setting the current issue
 [myLibrary setCurrentlyReadingIssue:myIssue];




                                                                                                     34
Handling Updates
Downloading content




                      35
INFORMING




Downloading Content              UPDATING                 ORGANIZING




NKAssetDownload
                                            DOWNLOADING




• Handles data transfer
  ■ Keeps going
• Uses NSURLConnectionDelegate
• Wake for critical events
      newsstand-content

• Wi-Fi only in background




                                                                       36
INFORMING




Downloading Content                                             UPDATING                 ORGANIZING




Setup
                                                                           DOWNLOADING




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];
}




                                                                                                      37
INFORMING




Downloading Content                         UPDATING                 ORGANIZING




NSURLConnectionDownloadDelegate
                                                       DOWNLOADING




 [asset downloadWithDelegate:myDelegate];

• Implements NSURLConnectionDelegate
  ■  Status
   ■ Authentication

   ■ Completion


• Modifications
 -connection:didReceiveData:




                                                                                  38
INFORMING




Downloading Content                                            UPDATING                 ORGANIZING




NSURLConnectionDownloadDelegate
                                                                          DOWNLOADING




 [asset downloadWithDelegate:myDelegate];

• Implements NSURLConnectionDelegate
  ■  Status
   ■ Authentication

   ■ Completion


• Modifications
 -connection:didWriteData:totalBytesWritten:expectedTotalBytesWritten:
 -connectionDidResumeDownloading:totalBytesWritten:expectedTotalBytesWritten:
 -connectionDidFinishLoading:




                                                                                                     39
INFORMING




Downloading Content                                              UPDATING                 ORGANIZING




NSURLConnectionDownloadDelegate
                                                                            DOWNLOADING




 [asset downloadWithDelegate:myDelegate];

• Implements NSURLConnectionDelegate
  ■  Status
   ■ Authentication

   ■ Completion


• Modifications
 -connection:didWriteData:totalBytesWritten:expectedTotalBytesWritten:
 -connectionDidResumeDownloading:totalBytesWritten:expectedTotalBytesWritten:
 -connectionDidFinishDownloading:destinationURL:      required




                                                                                                       40
INFORMING




Downloading Content                                          UPDATING                 ORGANIZING




Background
                                                                        DOWNLOADING




• What if the app is suspended?
  ■ No status updates
  ■ Wakes for authentication and completion




• What if the app is terminated!?
  ■   Relaunched in the background
 UIApplicationLaunchOptionsNewsstandDownloadsKey
 NSString *assetIdentifier = [myAssetDownload identifier];




                                                                                                   41
INFORMING




Downloading Content                                              UPDATING                 ORGANIZING




Reconnecting
                                                                            DOWNLOADING




• Reconnect on launch
 NKLibrary *library = [NKLibrary sharedLibrary];
 for (NKAssetDownload *asset in [library downloadingAssets])
       NSURLConnection *connection = [asset downloadWithDelegate:myDelegate];



• Always!
  ■   Abandoned downloads may get cancelled




                                                                                                       42
INFORMING




Downloading Content                                  UPDATING                 ORGANIZING




Completion
                                                                DOWNLOADING




• Success!
 -connectionDidFinishDownloading:destinationURL:
  ■ Destination is a temporary file
  ■ Move to issue repository

 [myIssue contentURL]
  ■   Process
 -[UIApplication beginTaskWithExpirationHandler:];




                                                                                           43
Demo
Downloading content




                      44
Updating Your Newsstand Icon


Jon Drummond




                               45
INFORMING




Updating Your Newsstand Icon                   UPDATING                 ORGANIZING




Showing off your new content
                                                          DOWNLOADING




• Part of getting new content
  is obtaining a new icon
• Once content is ready to view,
  show it off!
    ■ Update your Newsstand icon

    ■ Inform readers of new

      issues via badging




                                   June 2011
                                   May 2011


                                                                                     46
INFORMING




Updating Your Newsstand Icon                                 UPDATING                 ORGANIZING




Update your icon
                                                                        DOWNLOADING




• Publication covers play a huge role in the physical newsstand
  ■  We want your icons to do the same here
• Your icon should represent your most recent content
   ■ But don’t show it until your content is ready to read!


• Changes the appearance of your app in Newsstand and app switcher
   ■ Overrides your UINewsstandIcon, not your standard app icon




                                                                                                   47
INFORMING




Updating Your Newsstand Icon                             UPDATING                 ORGANIZING




Update your icon
                                                                    DOWNLOADING




• Simple!
 -[UIApplication setNewsstandIconImage:(UIImage*)]

• Can be used while running in the background, so update whenever
 your content is ready




                                                                                               48
INFORMING




Updating Your Newsstand Icon                               UPDATING                 ORGANIZING




Badge your app
                                                                      DOWNLOADING




• Badges in Newsstand have a revised look: “New” sash
• Add a badge when a user has not yet opened a particular issue
  ■   Remove the badge once it has been read




                                                                                                 49
INFORMING




Updating Your Newsstand Icon                                  UPDATING                 ORGANIZING




Badge your app
                                                                         DOWNLOADING




• Uses existing badge API
 -[UIApplication setApplicationIconBadgeNumber:(NSInteger)]

• As with normal badging...
  ■ Non-zero value shows the sash
  ■ Zero clears the sash


• The count is not shown, but it should track your unread issues




                                                                                                    50
INFORMING




Updating Your Newsstand Icon                                     UPDATING                 ORGANIZING



                                                                            DOWNLOADING



- (void)connectionDidFinishDownloading:(NSURLConnection*)connection
                       destinationURL:(NSURL*)destinationURL {




}

                                                                                                       51
INFORMING




Updating Your Newsstand Icon                                     UPDATING                 ORGANIZING



                                                                            DOWNLOADING



- (void)connectionDidFinishDownloading:(NSURLConnection*)connection
                       destinationURL:(NSURL*)destinationURL {
    // get issue content location
    NKIssue *latestIssue = [[connection newsstandAssetDownload] issue];
    NSURL *issueURL = [[latestIssue contentURL] URLByAppendingPathComponent:...];




}

                                                                                                       52
INFORMING




Updating Your Newsstand Icon                                     UPDATING                 ORGANIZING



                                                                            DOWNLOADING



- (void)connectionDidFinishDownloading:(NSURLConnection*)connection
                       destinationURL:(NSURL*)destinationURL {
    // get issue content location
    NKIssue *latestIssue = [[connection newsstandAssetDownload] issue];
    NSURL *issueURL = [[latestIssue contentURL] URLByAppendingPathComponent:...];


    // move issue into place -- don’t forget to check errors!
    NSFileManager *fileManager = [NSFileManager defaultManager];
    [fileManager moveItemAtURL:destinationURL toURL:issueURL error:NULL];




}

                                                                                                       53
INFORMING




Updating Your Newsstand Icon                                     UPDATING                 ORGANIZING



                                                                            DOWNLOADING



- (void)connectionDidFinishDownloading:(NSURLConnection*)connection
                       destinationURL:(NSURL*)destinationURL {
    // get issue content location
    NKIssue *latestIssue = [[connection newsstandAssetDownload] issue];
    NSURL *issueURL = [[latestIssue contentURL] URLByAppendingPathComponent:...];


    // move issue into place -- don’t forget to check errors!
    NSFileManager *fileManager = [NSFileManager defaultManager];
    [fileManager moveItemAtURL:destinationURL toURL:issueURL error:NULL];


    // get our new icon and update our app!
    UIImage *newIcon = [self getIconFromIssue:latestIssue]; // up to you




}

                                                                                                       54
INFORMING




Updating Your Newsstand Icon                                     UPDATING                 ORGANIZING



                                                                            DOWNLOADING



- (void)connectionDidFinishDownloading:(NSURLConnection*)connection
                       destinationURL:(NSURL*)destinationURL {
    // get issue content location
    NKIssue *latestIssue = [[connection newsstandAssetDownload] issue];
    NSURL *issueURL = [[latestIssue contentURL] URLByAppendingPathComponent:...];


    // move issue into place -- don’t forget to check errors!
    NSFileManager *fileManager = [NSFileManager defaultManager];
    [fileManager moveItemAtURL:destinationURL toURL:issueURL error:NULL];


    // get our new icon and update our app!
    UIImage *newIcon = [self getIconFromIssue:latestIssue]; // up to you
    UIApplication *app = [UIApplication sharedApplication];
    [app setNewsstandIconImage:newIcon];
    [app setApplicationIconBadgeNumber:[app applicationIconBadgeNumber]+1];
}

                                                                                                       55
Demo
Updating your Newsstand icon




                               56
Summary

• Becoming a Newsstand app is easy
• Get content updates in the background
• Use NewsstandKit to download and organize content
• Update your Newsstand icon and badge to show off your content




                                                                  57
More Information

Vicki Murley
Safari Technology Evangelist
vicki@apple.com




                               58
Related Sessions

                                     Presidio
App Publishing with iTunes Connect   Thursday 10:15AM

                                     Pacific Heights
Local and Push Notifications         Thursday 4:30PM

                                     Russian Hill
Adopting Multitasking                Thursday 4:30PM




                                                        59
Labs

                                         Internet & Web Lab B
Newsstand Lab                            Thursday 2:00PM

                                         Internet & Web Lab A
App Publishing with iTunes Connect Lab   Thursday 2:00PM

                                         Internet & Web Lab A
Local and Push Notifications Lab         Friday 9:00AM




                                                                60
Q&A




      61
62

More Related Content

Similar to Building newsstand_apps

iPhone Programming [7/17] : Behind the Scene
iPhone Programming [7/17] : Behind the SceneiPhone Programming [7/17] : Behind the Scene
iPhone Programming [7/17] : Behind the SceneIMC Institute
 
Adobe AIR Development for the BlackBerry PlayBook
Adobe AIR Development for the BlackBerry PlayBookAdobe AIR Development for the BlackBerry PlayBook
Adobe AIR Development for the BlackBerry PlayBookKyle McInnes
 
Quick Start to iOS Development
Quick Start to iOS DevelopmentQuick Start to iOS Development
Quick Start to iOS DevelopmentJussi Pohjolainen
 
Get step-by-step instructions on implementing notifications in your apps.
Get step-by-step instructions on implementing notifications in your apps.Get step-by-step instructions on implementing notifications in your apps.
Get step-by-step instructions on implementing notifications in your apps.Jigar Maheshwari
 
How to create an InfoCube
How to create an InfoCubeHow to create an InfoCube
How to create an InfoCubeMarcelo Honores
 
NDC 2011 - Building .NET Applications with BDD
NDC 2011 - Building .NET Applications with BDDNDC 2011 - Building .NET Applications with BDD
NDC 2011 - Building .NET Applications with BDDjbandi
 
Beginning iOS6 Development CH06 Multiview Applications
Beginning iOS6 Development CH06 Multiview ApplicationsBeginning iOS6 Development CH06 Multiview Applications
Beginning iOS6 Development CH06 Multiview ApplicationsAbdulrazzaq Alnajjar
 
Keynote: Software Kept Eating the World (Pivotal Cloud Platform Roadshow)
Keynote: Software Kept Eating the World (Pivotal Cloud Platform Roadshow)Keynote: Software Kept Eating the World (Pivotal Cloud Platform Roadshow)
Keynote: Software Kept Eating the World (Pivotal Cloud Platform Roadshow)VMware Tanzu
 
The LeanIX Microservices Integration
The LeanIX Microservices IntegrationThe LeanIX Microservices Integration
The LeanIX Microservices IntegrationLeanIX GmbH
 
iPhone Programming in 30 minutes (?) [FTS]
iPhone Programming in 30 minutes (?) [FTS]iPhone Programming in 30 minutes (?) [FTS]
iPhone Programming in 30 minutes (?) [FTS]Diego Pizzocaro
 
Apple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical OverviewApple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical OverviewSammy Sunny
 
Xamarin.Mac Seminar
Xamarin.Mac SeminarXamarin.Mac Seminar
Xamarin.Mac SeminarXamarin
 
April iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance PresentationApril iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance PresentationLong Weekend LLC
 
XPages101 - Building an XPages app - Lotusphere 2011
XPages101 - Building an XPages app - Lotusphere 2011XPages101 - Building an XPages app - Lotusphere 2011
XPages101 - Building an XPages app - Lotusphere 2011Tim Clark
 
Передача состояния с iPhone на Apple Watch
Передача состояния с iPhone на Apple WatchПередача состояния с iPhone на Apple Watch
Передача состояния с iPhone на Apple Watchru_Parallels
 

Similar to Building newsstand_apps (20)

Introduction of Xcode
Introduction of XcodeIntroduction of Xcode
Introduction of Xcode
 
iPhone Programming [7/17] : Behind the Scene
iPhone Programming [7/17] : Behind the SceneiPhone Programming [7/17] : Behind the Scene
iPhone Programming [7/17] : Behind the Scene
 
Dependency Injection with Apex
Dependency Injection with ApexDependency Injection with Apex
Dependency Injection with Apex
 
Adobe AIR Development for the BlackBerry PlayBook
Adobe AIR Development for the BlackBerry PlayBookAdobe AIR Development for the BlackBerry PlayBook
Adobe AIR Development for the BlackBerry PlayBook
 
Quick Start to iOS Development
Quick Start to iOS DevelopmentQuick Start to iOS Development
Quick Start to iOS Development
 
Hello world ios v1
Hello world ios v1Hello world ios v1
Hello world ios v1
 
Get step-by-step instructions on implementing notifications in your apps.
Get step-by-step instructions on implementing notifications in your apps.Get step-by-step instructions on implementing notifications in your apps.
Get step-by-step instructions on implementing notifications in your apps.
 
How to create an InfoCube
How to create an InfoCubeHow to create an InfoCube
How to create an InfoCube
 
NDC 2011 - Building .NET Applications with BDD
NDC 2011 - Building .NET Applications with BDDNDC 2011 - Building .NET Applications with BDD
NDC 2011 - Building .NET Applications with BDD
 
Beginning iOS6 Development CH06 Multiview Applications
Beginning iOS6 Development CH06 Multiview ApplicationsBeginning iOS6 Development CH06 Multiview Applications
Beginning iOS6 Development CH06 Multiview Applications
 
Keynote: Software Kept Eating the World (Pivotal Cloud Platform Roadshow)
Keynote: Software Kept Eating the World (Pivotal Cloud Platform Roadshow)Keynote: Software Kept Eating the World (Pivotal Cloud Platform Roadshow)
Keynote: Software Kept Eating the World (Pivotal Cloud Platform Roadshow)
 
The LeanIX Microservices Integration
The LeanIX Microservices IntegrationThe LeanIX Microservices Integration
The LeanIX Microservices Integration
 
iPhone Programming in 30 minutes (?) [FTS]
iPhone Programming in 30 minutes (?) [FTS]iPhone Programming in 30 minutes (?) [FTS]
iPhone Programming in 30 minutes (?) [FTS]
 
Apple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical OverviewApple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical Overview
 
RAD in Action: FireUI
RAD in Action: FireUIRAD in Action: FireUI
RAD in Action: FireUI
 
Dependency Injection Styles
Dependency Injection StylesDependency Injection Styles
Dependency Injection Styles
 
Xamarin.Mac Seminar
Xamarin.Mac SeminarXamarin.Mac Seminar
Xamarin.Mac Seminar
 
April iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance PresentationApril iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance Presentation
 
XPages101 - Building an XPages app - Lotusphere 2011
XPages101 - Building an XPages app - Lotusphere 2011XPages101 - Building an XPages app - Lotusphere 2011
XPages101 - Building an XPages app - Lotusphere 2011
 
Передача состояния с iPhone на Apple Watch
Передача состояния с iPhone на Apple WatchПередача состояния с iPhone на Apple Watch
Передача состояния с iPhone на Apple Watch
 

More from Hessel van Tuinen

Vorig seizoen kampioen geworden met sterk collectief
Vorig seizoen kampioen geworden met sterk collectiefVorig seizoen kampioen geworden met sterk collectief
Vorig seizoen kampioen geworden met sterk collectiefHessel van Tuinen
 
Future-of-wearable-computing
Future-of-wearable-computingFuture-of-wearable-computing
Future-of-wearable-computingHessel van Tuinen
 
V1.3 steljevoormet googleglass
V1.3 steljevoormet googleglassV1.3 steljevoormet googleglass
V1.3 steljevoormet googleglassHessel van Tuinen
 
Act the-european-app-economy-20131
Act the-european-app-economy-20131Act the-european-app-economy-20131
Act the-european-app-economy-20131Hessel van Tuinen
 
Lrkc invloedvanmobieleappsophetleefritmeinnederland-111025083235-phpapp02
Lrkc invloedvanmobieleappsophetleefritmeinnederland-111025083235-phpapp02Lrkc invloedvanmobieleappsophetleefritmeinnederland-111025083235-phpapp02
Lrkc invloedvanmobieleappsophetleefritmeinnederland-111025083235-phpapp02Hessel van Tuinen
 

More from Hessel van Tuinen (11)

Vorig seizoen kampioen geworden met sterk collectief
Vorig seizoen kampioen geworden met sterk collectiefVorig seizoen kampioen geworden met sterk collectief
Vorig seizoen kampioen geworden met sterk collectief
 
Ibeacons bible
Ibeacons bibleIbeacons bible
Ibeacons bible
 
Next marketing wearables
Next marketing wearablesNext marketing wearables
Next marketing wearables
 
Google Glass NL jan'14
Google Glass NL jan'14Google Glass NL jan'14
Google Glass NL jan'14
 
Project glass
Project glassProject glass
Project glass
 
Future-of-wearable-computing
Future-of-wearable-computingFuture-of-wearable-computing
Future-of-wearable-computing
 
V1.3 steljevoormet googleglass
V1.3 steljevoormet googleglassV1.3 steljevoormet googleglass
V1.3 steljevoormet googleglass
 
Act the-european-app-economy-20131
Act the-european-app-economy-20131Act the-european-app-economy-20131
Act the-european-app-economy-20131
 
Google+smc050
Google+smc050Google+smc050
Google+smc050
 
Lrkc invloedvanmobieleappsophetleefritmeinnederland-111025083235-phpapp02
Lrkc invloedvanmobieleappsophetleefritmeinnederland-111025083235-phpapp02Lrkc invloedvanmobieleappsophetleefritmeinnederland-111025083235-phpapp02
Lrkc invloedvanmobieleappsophetleefritmeinnederland-111025083235-phpapp02
 
Hyper senses 'mobile apps'
Hyper senses 'mobile apps'Hyper senses 'mobile apps'
Hyper senses 'mobile apps'
 

Recently uploaded

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
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
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
 
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
 
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
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
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
 

Recently uploaded (20)

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
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
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
 
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
 
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
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
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.
 

Building newsstand_apps

  • 1. Building Newsstand Apps Session 504 Ben Nielsen iOS Application Engineering These are confidential sessions—please refrain from streaming, blogging, or taking pictures 1
  • 2. 2
  • 3. 3
  • 4. 4
  • 5. 5
  • 6. 2 22 6
  • 8. Newsstand The look • Repository for publications • Richer visual experience • Icons reflect content • iTunes Store integration 8
  • 9. NewsstandKit Your App • Push notification updates NewsstandKit UIKit NKLibrary • Content organization NKIssue NKAssetDownload Foundation • Background downloads 9
  • 10. What You’ll Learn • Appearing in Newsstand • Retrieving content • Presenting content 10
  • 11. Appearing in Newsstand Jon Drummond iOS Application Engineering 11
  • 12. Appearing in Newsstand Becoming a Newsstand app • Add one key to your Info.plist <key>UINewsstandApp</key> <true/> • You’re now a Newsstand app! • But you need an icon… 12
  • 13. Appearing in Newsstand Time for an icon • One icon style in iOS 4 ■ Home screen ■ Search ■ Settings ■ App switcher ■ Notifications 13
  • 14. 14
  • 15. Appearing in Newsstand Newsstand icons • Distinct from standard app icons ■ Home screen and app switcher • Should reflect your content • Dynamic—can be updated after your app is installed • Additional adornment for magazine and newspaper styles 15
  • 16. Appearing in Newsstand Standard icons • We still need them! ■ Settings, Search, Notifications… • Newsstand icon must be defined in addition to the standard icon 16
  • 17. Appearing in Newsstand Standard icon specification • Top-level key in your Info.plist with an array of image names <key>CFBundleIconFiles</key> <array> ! <string>Icon.png</string> ! <string>Icon@2x.png</string> ... </array> 17
  • 18. Appearing in Newsstand Newsstand icons • A new top-level Info.plist key ■ CFBundleIcons—a dictionary of icon styles CFBundlePrimaryIcon UINewsstandIcon 18
  • 19. Appearing in Newsstand 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> 19
  • 20. Appearing in Newsstand Updating your Info.plist <key>CFBundleIcons</key> New top-level key <dict> <key>CFBundlePrimaryIcon</key> Icon style key <dict>...</dict> <dict> <key>CFBundleIconFiles</key> <array> Existing CFBundleIconFiles <string>Icon.png</string> <string>Icon@2x.png</string> </array> </dict> </dict> 20
  • 21. Appearing in Newsstand Customizing your Newsstand icon • Icons are adorned to resemble their physical counterparts ■ Newspaper or magazine? ■ Binding edge • Exist as keys inside the UINewsstandIcon style dictionary 21
  • 22. Appearing in Newsstand Customizing your Newsstand icon UINewsstandBindingTypeMagazine UINewsstandBindingTypeNewspaper Stack Staples Pages Fold UINewsstandBindingEdgeLeft UINewsstandBindingEdgeRight UINewsstandBindingEdgeBottom 22
  • 23. Appearing in Newsstand Updating your Info.plist <key>CFBundleIcons</key><dict> <key>UINewsstandIcon</key><dict> Newsstand style <key>CFBundleIconFiles</key>...</array> key and icon files <key>UINewsstandBindingType</key> <string>UINewsstandBindingTypeNewspaper</string> Options <key>UINewsstandBindingEdge</key> <string>UINewsstandBindingEdgeBottom</string> </dict> </dict> 23
  • 24. Appearing in Newsstand Additional considerations • Icons need not be square ■ Use a shape that matches your physical appearance • You must still include CFBundlePrimaryIcon ■ Standard and Newsstand icon are both needed • Backward compatibility ■ CFBundleIcons is required for Newsstand apps in iOS 5 ■ Can coexist with existing icon keys for earlier versions of iOS 24
  • 26. Handling Updates Ben Nielsen iOS Application Engineering 26
  • 27. Handling Updates Retrieving and presenting content • Informing the app INFORMING • Organizing issues • Downloading content UPDATING ORGANIZING • Updating your icon DOWNLOADING 27
  • 29. INFORMING Informing the App UPDATING ORGANIZING Push notifications DOWNLOADING 29
  • 30. INFORMING Informing the App UPDATING ORGANIZING Newsstand Push Notifications DOWNLOADING • Registration Type UIRemoteNotificationTypeNewsstandContentAvailability • Payload Key { ‘aps’:{ ‘content-available’:1 } } • Once per day ■ NSUserDefaults: @”NKDontThrottleNewsstandContentNotifications” 30
  • 31. INFORMING Informing the App UPDATING ORGANIZING Newsstand Push Notifications DOWNLOADING • Background mode <key>UIBackgroundModes</key> <array> <string>newsstand-content</string> </array> • Limited time -[UIApplication beginTaskWithExpirationHandler:] 31
  • 33. INFORMING Organizing Issues UPDATING ORGANIZING Using NKLibrary DOWNLOADING • Provides persistent state for: ■ Available issues ■ Ongoing downloads ■ Issue being read • Organizes issues ■ Uses app’s Caches directory ■ Improves resource management 33
  • 34. INFORMING Organizing Issues UPDATING ORGANIZING NKIssues DOWNLOADING • Creating issues ■ Unique name ■ Publication date NKIssue *myIssue = [myLibrary addIssueWithName:issueName date:issueDate]; ■ Maintains a repository within the library NSURL *baseURL = [myIssue contentURL]; • Setting the current issue [myLibrary setCurrentlyReadingIssue:myIssue]; 34
  • 36. INFORMING Downloading Content UPDATING ORGANIZING NKAssetDownload DOWNLOADING • Handles data transfer ■ Keeps going • Uses NSURLConnectionDelegate • Wake for critical events newsstand-content • Wi-Fi only in background 36
  • 37. INFORMING Downloading Content UPDATING ORGANIZING Setup DOWNLOADING 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]; } 37
  • 38. INFORMING Downloading Content UPDATING ORGANIZING NSURLConnectionDownloadDelegate DOWNLOADING [asset downloadWithDelegate:myDelegate]; • Implements NSURLConnectionDelegate ■ Status ■ Authentication ■ Completion • Modifications -connection:didReceiveData: 38
  • 39. INFORMING Downloading Content UPDATING ORGANIZING NSURLConnectionDownloadDelegate DOWNLOADING [asset downloadWithDelegate:myDelegate]; • Implements NSURLConnectionDelegate ■ Status ■ Authentication ■ Completion • Modifications -connection:didWriteData:totalBytesWritten:expectedTotalBytesWritten: -connectionDidResumeDownloading:totalBytesWritten:expectedTotalBytesWritten: -connectionDidFinishLoading: 39
  • 40. INFORMING Downloading Content UPDATING ORGANIZING NSURLConnectionDownloadDelegate DOWNLOADING [asset downloadWithDelegate:myDelegate]; • Implements NSURLConnectionDelegate ■ Status ■ Authentication ■ Completion • Modifications -connection:didWriteData:totalBytesWritten:expectedTotalBytesWritten: -connectionDidResumeDownloading:totalBytesWritten:expectedTotalBytesWritten: -connectionDidFinishDownloading:destinationURL: required 40
  • 41. INFORMING Downloading Content UPDATING ORGANIZING Background DOWNLOADING • What if the app is suspended? ■ No status updates ■ Wakes for authentication and completion • What if the app is terminated!? ■ Relaunched in the background UIApplicationLaunchOptionsNewsstandDownloadsKey NSString *assetIdentifier = [myAssetDownload identifier]; 41
  • 42. INFORMING Downloading Content UPDATING ORGANIZING Reconnecting DOWNLOADING • Reconnect on launch NKLibrary *library = [NKLibrary sharedLibrary]; for (NKAssetDownload *asset in [library downloadingAssets]) NSURLConnection *connection = [asset downloadWithDelegate:myDelegate]; • Always! ■ Abandoned downloads may get cancelled 42
  • 43. INFORMING Downloading Content UPDATING ORGANIZING Completion DOWNLOADING • Success! -connectionDidFinishDownloading:destinationURL: ■ Destination is a temporary file ■ Move to issue repository [myIssue contentURL] ■ Process -[UIApplication beginTaskWithExpirationHandler:]; 43
  • 45. Updating Your Newsstand Icon Jon Drummond 45
  • 46. INFORMING Updating Your Newsstand Icon UPDATING ORGANIZING Showing off your new content DOWNLOADING • Part of getting new content is obtaining a new icon • Once content is ready to view, show it off! ■ Update your Newsstand icon ■ Inform readers of new issues via badging June 2011 May 2011 46
  • 47. INFORMING Updating Your Newsstand Icon UPDATING ORGANIZING Update your icon DOWNLOADING • Publication covers play a huge role in the physical newsstand ■ We want your icons to do the same here • Your icon should represent your most recent content ■ But don’t show it until your content is ready to read! • Changes the appearance of your app in Newsstand and app switcher ■ Overrides your UINewsstandIcon, not your standard app icon 47
  • 48. INFORMING Updating Your Newsstand Icon UPDATING ORGANIZING Update your icon DOWNLOADING • Simple! -[UIApplication setNewsstandIconImage:(UIImage*)] • Can be used while running in the background, so update whenever your content is ready 48
  • 49. INFORMING Updating Your Newsstand Icon UPDATING ORGANIZING Badge your app DOWNLOADING • Badges in Newsstand have a revised look: “New” sash • Add a badge when a user has not yet opened a particular issue ■ Remove the badge once it has been read 49
  • 50. INFORMING Updating Your Newsstand Icon UPDATING ORGANIZING Badge your app DOWNLOADING • Uses existing badge API -[UIApplication setApplicationIconBadgeNumber:(NSInteger)] • As with normal badging... ■ Non-zero value shows the sash ■ Zero clears the sash • The count is not shown, but it should track your unread issues 50
  • 51. INFORMING Updating Your Newsstand Icon UPDATING ORGANIZING DOWNLOADING - (void)connectionDidFinishDownloading:(NSURLConnection*)connection destinationURL:(NSURL*)destinationURL { } 51
  • 52. INFORMING Updating Your Newsstand Icon UPDATING ORGANIZING DOWNLOADING - (void)connectionDidFinishDownloading:(NSURLConnection*)connection destinationURL:(NSURL*)destinationURL { // get issue content location NKIssue *latestIssue = [[connection newsstandAssetDownload] issue]; NSURL *issueURL = [[latestIssue contentURL] URLByAppendingPathComponent:...]; } 52
  • 53. INFORMING Updating Your Newsstand Icon UPDATING ORGANIZING DOWNLOADING - (void)connectionDidFinishDownloading:(NSURLConnection*)connection destinationURL:(NSURL*)destinationURL { // get issue content location NKIssue *latestIssue = [[connection newsstandAssetDownload] issue]; NSURL *issueURL = [[latestIssue contentURL] URLByAppendingPathComponent:...]; // move issue into place -- don’t forget to check errors! NSFileManager *fileManager = [NSFileManager defaultManager]; [fileManager moveItemAtURL:destinationURL toURL:issueURL error:NULL]; } 53
  • 54. INFORMING Updating Your Newsstand Icon UPDATING ORGANIZING DOWNLOADING - (void)connectionDidFinishDownloading:(NSURLConnection*)connection destinationURL:(NSURL*)destinationURL { // get issue content location NKIssue *latestIssue = [[connection newsstandAssetDownload] issue]; NSURL *issueURL = [[latestIssue contentURL] URLByAppendingPathComponent:...]; // move issue into place -- don’t forget to check errors! NSFileManager *fileManager = [NSFileManager defaultManager]; [fileManager moveItemAtURL:destinationURL toURL:issueURL error:NULL]; // get our new icon and update our app! UIImage *newIcon = [self getIconFromIssue:latestIssue]; // up to you } 54
  • 55. INFORMING Updating Your Newsstand Icon UPDATING ORGANIZING DOWNLOADING - (void)connectionDidFinishDownloading:(NSURLConnection*)connection destinationURL:(NSURL*)destinationURL { // get issue content location NKIssue *latestIssue = [[connection newsstandAssetDownload] issue]; NSURL *issueURL = [[latestIssue contentURL] URLByAppendingPathComponent:...]; // move issue into place -- don’t forget to check errors! NSFileManager *fileManager = [NSFileManager defaultManager]; [fileManager moveItemAtURL:destinationURL toURL:issueURL error:NULL]; // get our new icon and update our app! UIImage *newIcon = [self getIconFromIssue:latestIssue]; // up to you UIApplication *app = [UIApplication sharedApplication]; [app setNewsstandIconImage:newIcon]; [app setApplicationIconBadgeNumber:[app applicationIconBadgeNumber]+1]; } 55
  • 57. Summary • Becoming a Newsstand app is easy • Get content updates in the background • Use NewsstandKit to download and organize content • Update your Newsstand icon and badge to show off your content 57
  • 58. More Information Vicki Murley Safari Technology Evangelist vicki@apple.com 58
  • 59. Related Sessions Presidio App Publishing with iTunes Connect Thursday 10:15AM Pacific Heights Local and Push Notifications Thursday 4:30PM Russian Hill Adopting Multitasking Thursday 4:30PM 59
  • 60. Labs Internet & Web Lab B Newsstand Lab Thursday 2:00PM Internet & Web Lab A App Publishing with iTunes Connect Lab Thursday 2:00PM Internet & Web Lab A Local and Push Notifications Lab Friday 9:00AM 60
  • 61. Q&A 61
  • 62. 62