SlideShare ist ein Scribd-Unternehmen logo
1 von 108
Downloaden Sie, um offline zu lesen
What’s new in iOS7
Networking and Multi-tasking
Jon Flanders
@jonflanders

Tuesday, September 3, 13
What you will learn...

Tuesday, September 3, 13
What you will learn...
§ All about the new options for multi-tasking and background execution

Tuesday, September 3, 13
Background Tasks

Tuesday, September 3, 13
Background Tasks
§ Ever since iOS4, apps could request extra time to execute after being sent
to the background

Tuesday, September 3, 13
Background Tasks
§ Ever since iOS4, apps could request extra time to execute after being sent
to the background
o

15 minutes of execution time

Tuesday, September 3, 13
Background Tasks
§ Ever since iOS4, apps could request extra time to execute after being sent
to the background
o

15 minutes of execution time

§ This API remains in iOS7, but you may not need to use it (more on this
later)

Tuesday, September 3, 13
Background Tasks
§ Ever since iOS4, apps could request extra time to execute after being sent
to the background
o

15 minutes of execution time

§ This API remains in iOS7, but you may not need to use it (more on this
later)
§ If you do use it, the execution semantics have changed

Tuesday, September 3, 13
Background Tasks
§ Ever since iOS4, apps could request extra time to execute after being sent
to the background
o

15 minutes of execution time

§ This API remains in iOS7, but you may not need to use it (more on this
later)
§ If you do use it, the execution semantics have changed
o

If user locked screen in iOS6, the background task would keep the phone awake

Tuesday, September 3, 13
Background Tasks
§ Ever since iOS4, apps could request extra time to execute after being sent
to the background
o

15 minutes of execution time

§ This API remains in iOS7, but you may not need to use it (more on this
later)
§ If you do use it, the execution semantics have changed
o
o

If user locked screen in iOS6, the background task would keep the phone awake
iOS7 puts the app to sleep; the app will get a time-slice once the phone wakes up

Tuesday, September 3, 13
Background Tasks
§ Ever since iOS4, apps could request extra time to execute after being sent
to the background
o

15 minutes of execution time

§ This API remains in iOS7, but you may not need to use it (more on this
later)
§ If you do use it, the execution semantics have changed
o
o
o

If user locked screen in iOS6, the background task would keep the phone awake
iOS7 puts the app to sleep; the app will get a time-slice once the phone wakes up
Execution time not guaranteed to be contiguous

Tuesday, September 3, 13
New App Switcher

Tuesday, September 3, 13
New App Switcher
§ One of the major changes in the OS

Tuesday, September 3, 13
New App Switcher
§ One of the major changes in the OS
§ User can swipe up on app snapshot to kill the app

Tuesday, September 3, 13
New App Switcher
§ One of the major changes in the OS
§ User can swipe up on app snapshot to kill the app
o

Unlike in iOS6, this also kills background execution

Tuesday, September 3, 13
New APIs

Tuesday, September 3, 13
New APIs
§ Background Fetch

Tuesday, September 3, 13
New APIs
§ Background Fetch
§ Remote Notifications

Tuesday, September 3, 13
New APIs
§ Background Fetch
§ Remote Notifications
§ Background Transfer Service

Tuesday, September 3, 13
Background Fetch

Tuesday, September 3, 13
Background Fetch
§ When an app opens, typically it shows fresh data

Tuesday, September 3, 13
Background Fetch
§ When an app opens, typically it shows fresh data
§ When an app is brought to the foreground after being in the background,
generally the first thing most apps do is refresh their data

Tuesday, September 3, 13
Background Fetch
§ When an app opens, typically it shows fresh data
§ When an app is brought to the foreground after being in the background,
generally the first thing most apps do is refresh their data
o

But update happens after the user is already in the app, so the user sees a transition

Tuesday, September 3, 13
Background Fetch
§ When an app opens, typically it shows fresh data
§ When an app is brought to the foreground after being in the background,
generally the first thing most apps do is refresh their data
o

But update happens after the user is already in the app, so the user sees a transition

§ Background Fetch enables an app to update its data in the background

Tuesday, September 3, 13
Background Fetch
§ When an app opens, typically it shows fresh data
§ When an app is brought to the foreground after being in the background,
generally the first thing most apps do is refresh their data
o

But update happens after the user is already in the app, so the user sees a transition

§ Background Fetch enables an app to update its data in the background
o

If an app is in the background, it will be assigned a time-slice

Tuesday, September 3, 13
Background Fetch
§ When an app opens, typically it shows fresh data
§ When an app is brought to the foreground after being in the background,
generally the first thing most apps do is refresh their data
o

But update happens after the user is already in the app, so the user sees a transition

§ Background Fetch enables an app to update its data in the background
o
o

If an app is in the background, it will be assigned a time-slice
If an app isn’t running, it will be started in the background and then assigned a timeslice

Tuesday, September 3, 13
Background Fetch
§ When an app opens, typically it shows fresh data
§ When an app is brought to the foreground after being in the background,
generally the first thing most apps do is refresh their data
o

But update happens after the user is already in the app, so the user sees a transition

§ Background Fetch enables an app to update its data in the background
o
o

o

If an app is in the background, it will be assigned a time-slice
If an app isn’t running, it will be started in the background and then assigned a timeslice
When and how often the app is assigned a time-slice is controlled by the OS

Tuesday, September 3, 13
Background Fetch API

Tuesday, September 3, 13
Background Fetch API
§ Set the UIBackgroundModes value in the Info.plist to “fetch”

Tuesday, September 3, 13
Background Fetch API
§ Set the UIBackgroundModes value in the Info.plist to “fetch”
o

This can also be set this via the new Capabilities page in Xcode

Tuesday, September 3, 13
Background Fetch API
§ Set the UIBackgroundModes value in the Info.plist to “fetch”
o

This can also be set this via the new Capabilities page in Xcode

§ Set the background fetch interval range on your Application object

Tuesday, September 3, 13
Background Fetch API
§ Set the UIBackgroundModes value in the Info.plist to “fetch”
o

This can also be set this via the new Capabilities page in Xcode

§ Set the background fetch interval range on your Application object
o

No repeating interval

Tuesday, September 3, 13
Background Fetch API
§ Set the UIBackgroundModes value in the Info.plist to “fetch”
o

This can also be set this via the new Capabilities page in Xcode

§ Set the background fetch interval range on your Application object
o
o

No repeating interval
Time-slice assignment is managed by the OS, the range is set by the developer

Tuesday, September 3, 13
Background Fetch API
§ Set the UIBackgroundModes value in the Info.plist to “fetch”
o

This can also be set this via the new Capabilities page in Xcode

§ Set the background fetch interval range on your Application object
o
o

No repeating interval
Time-slice assignment is managed by the OS, the range is set by the developer

§ New delegate callback

Tuesday, September 3, 13
Background Fetch API
§ Set the UIBackgroundModes value in the Info.plist to “fetch”
o

This can also be set this via the new Capabilities page in Xcode

§ Set the background fetch interval range on your Application object
o
o

No repeating interval
Time-slice assignment is managed by the OS, the range is set by the developer

§ New delegate callback
o

performFetchWithCompletionHandler

Tuesday, September 3, 13
Background Fetch API
§ Set the UIBackgroundModes value in the Info.plist to “fetch”
o

This can also be set this via the new Capabilities page in Xcode

§ Set the background fetch interval range on your Application object
o
o

No repeating interval
Time-slice assignment is managed by the OS, the range is set by the developer

§ New delegate callback
o
o

performFetchWithCompletionHandler
Do your work: call the completion handler when you are done

Tuesday, September 3, 13
Background Fetch API
§ Set the UIBackgroundModes value in the Info.plist to “fetch”
o

This can also be set this via the new Capabilities page in Xcode

§ Set the background fetch interval range on your Application object
o
o

No repeating interval
Time-slice assignment is managed by the OS, the range is set by the developer

§ New delegate callback
o
o
o

performFetchWithCompletionHandler
Do your work: call the completion handler when you are done
After the completion handler is called, if you have new data, it will create a new
snapshot of your app

Tuesday, September 3, 13
Background Fetch API
§ Set the UIBackgroundModes value in the Info.plist to “fetch”
o

This can also be set this via the new Capabilities page in Xcode

§ Set the background fetch interval range on your Application object
o
o

No repeating interval
Time-slice assignment is managed by the OS, the range is set by the developer

§ New delegate callback
o
o
o

performFetchWithCompletionHandler
Do your work: call the completion handler when you are done
After the completion handler is called, if you have new data, it will create a new
snapshot of your app

§ Update UI for App Switcher

Tuesday, September 3, 13
Background Fetch API
§ Set the UIBackgroundModes value in the Info.plist to “fetch”
o

This can also be set this via the new Capabilities page in Xcode

§ Set the background fetch interval range on your Application object
o
o

No repeating interval
Time-slice assignment is managed by the OS, the range is set by the developer

§ New delegate callback
o
o
o

performFetchWithCompletionHandler
Do your work: call the completion handler when you are done
After the completion handler is called, if you have new data, it will create a new
snapshot of your app

§ Update UI for App Switcher
§ You can test this via debug properties

Tuesday, September 3, 13
Background Fetch API
§ Set the UIBackgroundModes value in the Info.plist to “fetch”
o

This can also be set this via the new Capabilities page in Xcode

§ Set the background fetch interval range on your Application object
o
o

No repeating interval
Time-slice assignment is managed by the OS, the range is set by the developer

§ New delegate callback
o
o
o

performFetchWithCompletionHandler
Do your work: call the completion handler when you are done
After the completion handler is called, if you have new data, it will create a new
snapshot of your app

§ Update UI for App Switcher
§ You can test this via debug properties
o

Also on Debug menu

Tuesday, September 3, 13
Remote Notifications

Tuesday, September 3, 13
Remote Notifications
§ Since iOS4, notifications could be sent through Apple’s Push Notification
Service (APNS)

Tuesday, September 3, 13
Remote Notifications
§ Since iOS4, notifications could be sent through Apple’s Push Notification
Service (APNS)
§ Often sent to notify user of new data

Tuesday, September 3, 13
Remote Notifications
§ Since iOS4, notifications could be sent through Apple’s Push Notification
Service (APNS)
§ Often sent to notify user of new data
o

User is notified via alert or popup

Tuesday, September 3, 13
Remote Notifications
§ Since iOS4, notifications could be sent through Apple’s Push Notification
Service (APNS)
§ Often sent to notify user of new data
o
o

User is notified via alert or popup
If the user clicked on UI, the app was either brought to foreground or started

Tuesday, September 3, 13
Remote Notifications
§ Since iOS4, notifications could be sent through Apple’s Push Notification
Service (APNS)
§ Often sent to notify user of new data
o
o
o

User is notified via alert or popup
If the user clicked on UI, the app was either brought to foreground or started
Race condition: what if app can’t show new data yet because new data can’t even
start to be retrieved until app is in the foreground

Tuesday, September 3, 13
Remote Notifications
§ Since iOS4, notifications could be sent through Apple’s Push Notification
Service (APNS)
§ Often sent to notify user of new data
o
o
o

User is notified via alert or popup
If the user clicked on UI, the app was either brought to foreground or started
Race condition: what if app can’t show new data yet because new data can’t even
start to be retrieved until app is in the foreground

§ iOS7 enables you to send a notification with a new flag

Tuesday, September 3, 13
Remote Notifications
§ Since iOS4, notifications could be sent through Apple’s Push Notification
Service (APNS)
§ Often sent to notify user of new data
o
o
o

User is notified via alert or popup
If the user clicked on UI, the app was either brought to foreground or started
Race condition: what if app can’t show new data yet because new data can’t even
start to be retrieved until app is in the foreground

§ iOS7 enables you to send a notification with a new flag
o

content-available : 1

Tuesday, September 3, 13
Remote Notifications
§ Since iOS4, notifications could be sent through Apple’s Push Notification
Service (APNS)
§ Often sent to notify user of new data
o
o
o

User is notified via alert or popup
If the user clicked on UI, the app was either brought to foreground or started
Race condition: what if app can’t show new data yet because new data can’t even
start to be retrieved until app is in the foreground

§ iOS7 enables you to send a notification with a new flag
o
o

content-available : 1
When set, the app gets executed before the user gets the notification

Tuesday, September 3, 13
Remote Notifications
§ Since iOS4, notifications could be sent through Apple’s Push Notification
Service (APNS)
§ Often sent to notify user of new data
o
o
o

User is notified via alert or popup
If the user clicked on UI, the app was either brought to foreground or started
Race condition: what if app can’t show new data yet because new data can’t even
start to be retrieved until app is in the foreground

§ iOS7 enables you to send a notification with a new flag
o
o
o

content-available : 1
When set, the app gets executed before the user gets the notification
Hopefully you can get that new data before the user clicks the alert to bring the app
to the foreground

Tuesday, September 3, 13
Remote Notifications
§ Since iOS4, notifications could be sent through Apple’s Push Notification
Service (APNS)
§ Often sent to notify user of new data
o
o
o

User is notified via alert or popup
If the user clicked on UI, the app was either brought to foreground or started
Race condition: what if app can’t show new data yet because new data can’t even
start to be retrieved until app is in the foreground

§ iOS7 enables you to send a notification with a new flag
o
o
o

content-available : 1
When set, the app gets executed before the user gets the notification
Hopefully you can get that new data before the user clicks the alert to bring the app
to the foreground

§ Send content-available:1 without an alert in the payload of the
notification

Tuesday, September 3, 13
Remote Notifications
§ Since iOS4, notifications could be sent through Apple’s Push Notification
Service (APNS)
§ Often sent to notify user of new data
o
o
o

User is notified via alert or popup
If the user clicked on UI, the app was either brought to foreground or started
Race condition: what if app can’t show new data yet because new data can’t even
start to be retrieved until app is in the foreground

§ iOS7 enables you to send a notification with a new flag
o
o
o

content-available : 1
When set, the app gets executed before the user gets the notification
Hopefully you can get that new data before the user clicks the alert to bring the app
to the foreground

§ Send content-available:1 without an alert in the payload of the
notification
o

This becomes a silent notification and is delivered to the app in the background

Tuesday, September 3, 13
Remote Notifications API

Tuesday, September 3, 13
Remote Notifications API
§ Set UIBackgroundModes to remote-notification in Info.plist

Tuesday, September 3, 13
Remote Notifications API
§ Set UIBackgroundModes to remote-notification in Info.plist
o

Or use new Capabilities UI in Xcode

Tuesday, September 3, 13
Remote Notifications API
§ Set UIBackgroundModes to remote-notification in Info.plist
o

Or use new Capabilities UI in Xcode

§ Make sure to set content-available: 1 in the payload

Tuesday, September 3, 13
Remote Notifications API
§ Set UIBackgroundModes to remote-notification in Info.plist
o

Or use new Capabilities UI in Xcode

§ Make sure to set content-available: 1 in the payload
§ The application:didReceiveRemoteNotification:fetchCompletionHandler
is called with a non-null completion handler

Tuesday, September 3, 13
Remote Notifications API
§ Set UIBackgroundModes to remote-notification in Info.plist
o

Or use new Capabilities UI in Xcode

§ Make sure to set content-available: 1 in the payload
§ The application:didReceiveRemoteNotification:fetchCompletionHandler
is called with a non-null completion handler
o

Call the completion handler when you are done

Tuesday, September 3, 13
Remote Notifications API
§ Set UIBackgroundModes to remote-notification in Info.plist
o

Or use new Capabilities UI in Xcode

§ Make sure to set content-available: 1 in the payload
§ The application:didReceiveRemoteNotification:fetchCompletionHandler
is called with a non-null completion handler
o
o

Call the completion handler when you are done
Silent notifications will be rate-limited. APNS does the work to make sure that device
isn’t overloaded – delayed but not rejected

Tuesday, September 3, 13
Networking in the Background

Tuesday, September 3, 13
Networking in the Background
§ Before iOS7, you might want to download or upload a resource after the
your app has gone to the background

Tuesday, September 3, 13
Networking in the Background
§ Before iOS7, you might want to download or upload a resource after the
your app has gone to the background
§ Background Task API would give you a set time-slice

Tuesday, September 3, 13
Networking in the Background
§ Before iOS7, you might want to download or upload a resource after the
your app has gone to the background
§ Background Task API would give you a set time-slice
o

What if your operation took longer than the time allowed (i.e. a large resource like a
video or image)?

Tuesday, September 3, 13
Background Transfer Service (BTS)

Tuesday, September 3, 13
Background Transfer Service (BTS)
§ iOS7 introduces the BTS

Tuesday, September 3, 13
Background Transfer Service (BTS)
§ iOS7 introduces the BTS
§ You can offload network work to the BTS

Tuesday, September 3, 13
Background Transfer Service (BTS)
§ iOS7 introduces the BTS
§ You can offload network work to the BTS
§ BTS will ensure that the work gets completed

Tuesday, September 3, 13
Background Transfer Service (BTS)
§ iOS7 introduces the BTS
§ You can offload network work to the BTS
§ BTS will ensure that the work gets completed
o

Works even if your app is in the background or even if it is terminated

Tuesday, September 3, 13
Background Transfer Service (BTS)
§ iOS7 introduces the BTS
§ You can offload network work to the BTS
§ BTS will ensure that the work gets completed
o
o

Works even if your app is in the background or even if it is terminated
If your app wakes up due to background fetch or notification, this is a great API to pair
with it

Tuesday, September 3, 13
Background Transfer Service (BTS)
§ iOS7 introduces the BTS
§ You can offload network work to the BTS
§ BTS will ensure that the work gets completed
o
o

Works even if your app is in the background or even if it is terminated
If your app wakes up due to background fetch or notification, this is a great API to pair
with it

§ BTS manages battery life and data

Tuesday, September 3, 13
Background Transfer Service (BTS)
§ iOS7 introduces the BTS
§ You can offload network work to the BTS
§ BTS will ensure that the work gets completed
o
o

Works even if your app is in the background or even if it is terminated
If your app wakes up due to background fetch or notification, this is a great API to pair
with it

§ BTS manages battery life and data
o

Requests are classified as discretionary or non-discretionary

Tuesday, September 3, 13
Background Transfer Service (BTS)
§ iOS7 introduces the BTS
§ You can offload network work to the BTS
§ BTS will ensure that the work gets completed
o
o

Works even if your app is in the background or even if it is terminated
If your app wakes up due to background fetch or notification, this is a great API to pair
with it

§ BTS manages battery life and data
o
o

Requests are classified as discretionary or non-discretionary
Discretionary requests will only happen when on WI-FI

Tuesday, September 3, 13
Background Transfer Service (BTS)
§ iOS7 introduces the BTS
§ You can offload network work to the BTS
§ BTS will ensure that the work gets completed
o
o

Works even if your app is in the background or even if it is terminated
If your app wakes up due to background fetch or notification, this is a great API to pair
with it

§ BTS manages battery life and data
o
o
o

Requests are classified as discretionary or non-discretionary
Discretionary requests will only happen when on WI-FI
Requests from the background are automatically discretionary

Tuesday, September 3, 13
Background Transfer Service (BTS)
§ iOS7 introduces the BTS
§ You can offload network work to the BTS
§ BTS will ensure that the work gets completed
o
o

Works even if your app is in the background or even if it is terminated
If your app wakes up due to background fetch or notification, this is a great API to pair
with it

§ BTS manages battery life and data
o
o
o
o

Requests are classified as discretionary or non-discretionary
Discretionary requests will only happen when on WI-FI
Requests from the background are automatically discretionary
Requests from the foreground can request to be discretionary

Tuesday, September 3, 13
NSURLSession

Tuesday, September 3, 13
NSURLSession
§ New object in iOS7

Tuesday, September 3, 13
NSURLSession
§ New object in iOS7
§ Subsumes the functionality of NSURLConnection

Tuesday, September 3, 13
NSURLSession
§ New object in iOS7
§ Subsumes the functionality of NSURLConnection
o

API is similar to NSURLConnection

Tuesday, September 3, 13
NSURLSession
§ New object in iOS7
§ Subsumes the functionality of NSURLConnection
o

API is similar to NSURLConnection

§ Adds more functionality than NSURLConnection

Tuesday, September 3, 13
NSURLSession
§ New object in iOS7
§ Subsumes the functionality of NSURLConnection
o

API is similar to NSURLConnection

§ Adds more functionality than NSURLConnection
o

Instance storage of credentials, cookies, and other state (vs. NSURLConnection’s global
shared state).

Tuesday, September 3, 13
NSURLSession
§ New object in iOS7
§ Subsumes the functionality of NSURLConnection
o

API is similar to NSURLConnection

§ Adds more functionality than NSURLConnection
o

Instance storage of credentials, cookies, and other state (vs. NSURLConnection’s global
shared state).

§ If your app goes to the background or even is terminated after you make
a NSURLSession request, BTS service will still complete the request

Tuesday, September 3, 13
NSURLSession
§ New object in iOS7
§ Subsumes the functionality of NSURLConnection
o

API is similar to NSURLConnection

§ Adds more functionality than NSURLConnection
o

Instance storage of credentials, cookies, and other state (vs. NSURLConnection’s global
shared state).

§ If your app goes to the background or even is terminated after you make
a NSURLSession request, BTS service will still complete the request
o

Your app is started or woken up when request is finished and you have a chance to
process

Tuesday, September 3, 13
NSURLSession API

Tuesday, September 3, 13
NSURLSession API
§ To create an NSURLSession, you need an NSURLSessionConfiguration
object

Tuesday, September 3, 13
NSURLSession API
§ To create an NSURLSession, you need an NSURLSessionConfiguration
object
o

Configuration object determines foreground/background execution, whether the
request will use only wi-fi, etc.

Tuesday, September 3, 13
NSURLSession API
§ To create an NSURLSession, you need an NSURLSessionConfiguration
object
o

o

Configuration object determines foreground/background execution, whether the
request will use only wi-fi, etc.
Background configuration gets an identifier (string) to use later to retrieve from BTS

Tuesday, September 3, 13
NSURLSession API
§ To create an NSURLSession, you need an NSURLSessionConfiguration
object
o

o

Configuration object determines foreground/background execution, whether the
request will use only wi-fi, etc.
Background configuration gets an identifier (string) to use later to retrieve from BTS

§ Implement to appropriate protocols

Tuesday, September 3, 13
NSURLSession API
§ To create an NSURLSession, you need an NSURLSessionConfiguration
object
o

o

Configuration object determines foreground/background execution, whether the
request will use only wi-fi, etc.
Background configuration gets an identifier (string) to use later to retrieve from BTS

§ Implement to appropriate protocols
o

NSURLSessionDelegate for high-level events

Tuesday, September 3, 13
NSURLSession API
§ To create an NSURLSession, you need an NSURLSessionConfiguration
object
o

o

Configuration object determines foreground/background execution, whether the
request will use only wi-fi, etc.
Background configuration gets an identifier (string) to use later to retrieve from BTS

§ Implement to appropriate protocols
o
o

NSURLSessionDelegate for high-level events
NSURLSessionTaskDelegate for data-level events

Tuesday, September 3, 13
NSURLSession API
§ To create an NSURLSession, you need an NSURLSessionConfiguration
object
o

o

Configuration object determines foreground/background execution, whether the
request will use only wi-fi, etc.
Background configuration gets an identifier (string) to use later to retrieve from BTS

§ Implement to appropriate protocols
o
o

NSURLSessionDelegate for high-level events
NSURLSessionTaskDelegate for data-level events

§ NSURLSessionTask really replaces NSURLConnection

Tuesday, September 3, 13
NSURLSession API
§ To create an NSURLSession, you need an NSURLSessionConfiguration
object
o

o

Configuration object determines foreground/background execution, whether the
request will use only wi-fi, etc.
Background configuration gets an identifier (string) to use later to retrieve from BTS

§ Implement to appropriate protocols
o
o

NSURLSessionDelegate for high-level events
NSURLSessionTaskDelegate for data-level events

§ NSURLSessionTask really replaces NSURLConnection
o

[resume] method to start task

Tuesday, September 3, 13
NSURLSession API
§ To create an NSURLSession, you need an NSURLSessionConfiguration
object
o

o

Configuration object determines foreground/background execution, whether the
request will use only wi-fi, etc.
Background configuration gets an identifier (string) to use later to retrieve from BTS

§ Implement to appropriate protocols
o
o

NSURLSessionDelegate for high-level events
NSURLSessionTaskDelegate for data-level events

§ NSURLSessionTask really replaces NSURLConnection
o
o

[resume] method to start task
[cancel],[suspend],[resume] control methods

Tuesday, September 3, 13
NSURLSession API
§ To create an NSURLSession, you need an NSURLSessionConfiguration
object
o

o

Configuration object determines foreground/background execution, whether the
request will use only wi-fi, etc.
Background configuration gets an identifier (string) to use later to retrieve from BTS

§ Implement to appropriate protocols
o
o

NSURLSessionDelegate for high-level events
NSURLSessionTaskDelegate for data-level events

§ NSURLSessionTask really replaces NSURLConnection
o
o
o

[resume] method to start task
[cancel],[suspend],[resume] control methods
Multiple sub-classes for different functions

Tuesday, September 3, 13
NSURLSession API
§ To create an NSURLSession, you need an NSURLSessionConfiguration
object
o

o

Configuration object determines foreground/background execution, whether the
request will use only wi-fi, etc.
Background configuration gets an identifier (string) to use later to retrieve from BTS

§ Implement to appropriate protocols
o
o

NSURLSessionDelegate for high-level events
NSURLSessionTaskDelegate for data-level events

§ NSURLSessionTask really replaces NSURLConnection
o
o
o

[resume] method to start task
[cancel],[suspend],[resume] control methods
Multiple sub-classes for different functions

§ NSURLSession also has block-based convenience methods as well

Tuesday, September 3, 13
NSURLSession API
§ To create an NSURLSession, you need an NSURLSessionConfiguration
object
o

o

Configuration object determines foreground/background execution, whether the
request will use only wi-fi, etc.
Background configuration gets an identifier (string) to use later to retrieve from BTS

§ Implement to appropriate protocols
o
o

NSURLSessionDelegate for high-level events
NSURLSessionTaskDelegate for data-level events

§ NSURLSessionTask really replaces NSURLConnection
o
o
o

[resume] method to start task
[cancel],[suspend],[resume] control methods
Multiple sub-classes for different functions

§ NSURLSession also has block-based convenience methods as well
o

Still need to call [resume] on task to kick off connection

Tuesday, September 3, 13
Background Considerations

Tuesday, September 3, 13
Background Considerations
§ Limited time

Tuesday, September 3, 13
Background Considerations
§ Limited time
o

You still only get a limited time to execute in the background (less than 1 minute)

Tuesday, September 3, 13
Background Considerations
§ Limited time
o
o

You still only get a limited time to execute in the background (less than 1 minute)
Make sure to call the completion handlers ALWAYS in less than 1 minute

Tuesday, September 3, 13
Background Considerations
§ Limited time
o
o
o

You still only get a limited time to execute in the background (less than 1 minute)
Make sure to call the completion handlers ALWAYS in less than 1 minute
Use BTS to enhance the work you can do when called in the background

Tuesday, September 3, 13
Background Considerations
§ Limited time
o
o
o

You still only get a limited time to execute in the background (less than 1 minute)
Make sure to call the completion handlers ALWAYS in less than 1 minute
Use BTS to enhance the work you can do when called in the background

§ User control

Tuesday, September 3, 13
Background Considerations
§ Limited time
o
o
o

You still only get a limited time to execute in the background (less than 1 minute)
Make sure to call the completion handlers ALWAYS in less than 1 minute
Use BTS to enhance the work you can do when called in the background

§ User control
o

User can turn off or limit background fetch

Tuesday, September 3, 13
Background Considerations
§ Limited time
o
o
o

You still only get a limited time to execute in the background (less than 1 minute)
Make sure to call the completion handlers ALWAYS in less than 1 minute
Use BTS to enhance the work you can do when called in the background

§ User control
o

User can turn off or limit background fetch

§ Data Protection

Tuesday, September 3, 13
Background Considerations
§ Limited time
o
o
o

You still only get a limited time to execute in the background (less than 1 minute)
Make sure to call the completion handlers ALWAYS in less than 1 minute
Use BTS to enhance the work you can do when called in the background

§ User control
o

User can turn off or limit background fetch

§ Data Protection
o

If you use the recommended levels of data protection, you won’t be able to access
files, keychain, or sqlite DBs when running in the background

Tuesday, September 3, 13
Background Considerations
§ Limited time
o
o
o

You still only get a limited time to execute in the background (less than 1 minute)
Make sure to call the completion handlers ALWAYS in less than 1 minute
Use BTS to enhance the work you can do when called in the background

§ User control
o

User can turn off or limit background fetch

§ Data Protection
o

o

If you use the recommended levels of data protection, you won’t be able to access
files, keychain, or sqlite DBs when running in the background
If you need credentials in the background, to lower risk, consider a token that expires
in a short amount of time

Tuesday, September 3, 13
Summary

Tuesday, September 3, 13
Summary
§ The new background execution features help your app seem to the user
to be running all the time

Tuesday, September 3, 13
Summary
§ The new background execution features help your app seem to the user
to be running all the time
§ The new NSURLSession and BTS make foreground networking code
simpler and background networking code possible

Tuesday, September 3, 13

Weitere ähnliche Inhalte

Ähnlich wie 4 whats-new-in-ios7-m4-multitasking-slides

1 whats-new-in-ios7-m1-slides
1 whats-new-in-ios7-m1-slides1 whats-new-in-ios7-m1-slides
1 whats-new-in-ios7-m1-slidesMasterCode.vn
 
3 whats-new-in-ios7-m3-uikit-slides
3 whats-new-in-ios7-m3-uikit-slides3 whats-new-in-ios7-m3-uikit-slides
3 whats-new-in-ios7-m3-uikit-slidesMasterCode.vn
 
iOS Backgrounding - SLC Cocoaheads
iOS Backgrounding - SLC CocoaheadsiOS Backgrounding - SLC Cocoaheads
iOS Backgrounding - SLC CocoaheadsDave Stevenson
 
2016 05-07 amro handy labs workshop
2016 05-07 amro handy labs workshop2016 05-07 amro handy labs workshop
2016 05-07 amro handy labs workshopLama K Banna
 
Orangescrum Mobile API Add on User Manual
Orangescrum Mobile API Add on User ManualOrangescrum Mobile API Add on User Manual
Orangescrum Mobile API Add on User ManualOrangescrum
 
How to write better code: in-depth best practices for writing readable, simpl...
How to write better code: in-depth best practices for writing readable, simpl...How to write better code: in-depth best practices for writing readable, simpl...
How to write better code: in-depth best practices for writing readable, simpl...Oursky
 
How to write better code: in-depth best practices for writing readable, simpl...
How to write better code: in-depth best practices for writing readable, simpl...How to write better code: in-depth best practices for writing readable, simpl...
How to write better code: in-depth best practices for writing readable, simpl...Jane Chung
 
Troubleshooting Live Java Web Applications
Troubleshooting Live Java Web ApplicationsTroubleshooting Live Java Web Applications
Troubleshooting Live Java Web Applicationsashleypuls
 
Time Log with Payment Add on User Manual
Time Log with Payment Add on User ManualTime Log with Payment Add on User Manual
Time Log with Payment Add on User ManualOrangescrum
 
Computing at scale
Computing at scaleComputing at scale
Computing at scalejerjou
 
Design Patterns for Mobile Applications
Design Patterns for Mobile ApplicationsDesign Patterns for Mobile Applications
Design Patterns for Mobile ApplicationsC4Media
 
FUTURESTACK13: Mobile Apps, A DevOps Way from Jonathan Karon, Engineering Man...
FUTURESTACK13: Mobile Apps, A DevOps Way from Jonathan Karon, Engineering Man...FUTURESTACK13: Mobile Apps, A DevOps Way from Jonathan Karon, Engineering Man...
FUTURESTACK13: Mobile Apps, A DevOps Way from Jonathan Karon, Engineering Man...New Relic
 
DevOps for the Enterprise: Automating Deployments
DevOps for the Enterprise: Automating DeploymentsDevOps for the Enterprise: Automating Deployments
DevOps for the Enterprise: Automating DeploymentsAmazon Web Services
 
FUTURESTACK13: What’s New and Upcoming with New Relic from Patrick Lightbody,...
FUTURESTACK13: What’s New and Upcoming with New Relic from Patrick Lightbody,...FUTURESTACK13: What’s New and Upcoming with New Relic from Patrick Lightbody,...
FUTURESTACK13: What’s New and Upcoming with New Relic from Patrick Lightbody,...New Relic
 
Wireframes app i_phone_ios7_example
Wireframes app i_phone_ios7_exampleWireframes app i_phone_ios7_example
Wireframes app i_phone_ios7_exampleAndrew Scott
 
Making awesome apps
Making awesome appsMaking awesome apps
Making awesome appsDroidConTLV
 
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP appsphp[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP appsPablo Godel
 
Hadoop webinar-130808141030-phpapp01
Hadoop webinar-130808141030-phpapp01Hadoop webinar-130808141030-phpapp01
Hadoop webinar-130808141030-phpapp01Kaushik Dey
 
Matt training-html-halfday
Matt training-html-halfdayMatt training-html-halfday
Matt training-html-halfdayMatthew Dobson
 

Ähnlich wie 4 whats-new-in-ios7-m4-multitasking-slides (20)

1 whats-new-in-ios7-m1-slides
1 whats-new-in-ios7-m1-slides1 whats-new-in-ios7-m1-slides
1 whats-new-in-ios7-m1-slides
 
3 whats-new-in-ios7-m3-uikit-slides
3 whats-new-in-ios7-m3-uikit-slides3 whats-new-in-ios7-m3-uikit-slides
3 whats-new-in-ios7-m3-uikit-slides
 
iOS Backgrounding - SLC Cocoaheads
iOS Backgrounding - SLC CocoaheadsiOS Backgrounding - SLC Cocoaheads
iOS Backgrounding - SLC Cocoaheads
 
2016 05-07 amro handy labs workshop
2016 05-07 amro handy labs workshop2016 05-07 amro handy labs workshop
2016 05-07 amro handy labs workshop
 
Orangescrum Mobile API Add on User Manual
Orangescrum Mobile API Add on User ManualOrangescrum Mobile API Add on User Manual
Orangescrum Mobile API Add on User Manual
 
How to write better code: in-depth best practices for writing readable, simpl...
How to write better code: in-depth best practices for writing readable, simpl...How to write better code: in-depth best practices for writing readable, simpl...
How to write better code: in-depth best practices for writing readable, simpl...
 
How to write better code: in-depth best practices for writing readable, simpl...
How to write better code: in-depth best practices for writing readable, simpl...How to write better code: in-depth best practices for writing readable, simpl...
How to write better code: in-depth best practices for writing readable, simpl...
 
Troubleshooting Live Java Web Applications
Troubleshooting Live Java Web ApplicationsTroubleshooting Live Java Web Applications
Troubleshooting Live Java Web Applications
 
Time Log with Payment Add on User Manual
Time Log with Payment Add on User ManualTime Log with Payment Add on User Manual
Time Log with Payment Add on User Manual
 
Computing at scale
Computing at scaleComputing at scale
Computing at scale
 
Design Patterns for Mobile Applications
Design Patterns for Mobile ApplicationsDesign Patterns for Mobile Applications
Design Patterns for Mobile Applications
 
FUTURESTACK13: Mobile Apps, A DevOps Way from Jonathan Karon, Engineering Man...
FUTURESTACK13: Mobile Apps, A DevOps Way from Jonathan Karon, Engineering Man...FUTURESTACK13: Mobile Apps, A DevOps Way from Jonathan Karon, Engineering Man...
FUTURESTACK13: Mobile Apps, A DevOps Way from Jonathan Karon, Engineering Man...
 
DevOps for the Enterprise: Automating Deployments
DevOps for the Enterprise: Automating DeploymentsDevOps for the Enterprise: Automating Deployments
DevOps for the Enterprise: Automating Deployments
 
Smartgears
SmartgearsSmartgears
Smartgears
 
FUTURESTACK13: What’s New and Upcoming with New Relic from Patrick Lightbody,...
FUTURESTACK13: What’s New and Upcoming with New Relic from Patrick Lightbody,...FUTURESTACK13: What’s New and Upcoming with New Relic from Patrick Lightbody,...
FUTURESTACK13: What’s New and Upcoming with New Relic from Patrick Lightbody,...
 
Wireframes app i_phone_ios7_example
Wireframes app i_phone_ios7_exampleWireframes app i_phone_ios7_example
Wireframes app i_phone_ios7_example
 
Making awesome apps
Making awesome appsMaking awesome apps
Making awesome apps
 
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP appsphp[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
 
Hadoop webinar-130808141030-phpapp01
Hadoop webinar-130808141030-phpapp01Hadoop webinar-130808141030-phpapp01
Hadoop webinar-130808141030-phpapp01
 
Matt training-html-halfday
Matt training-html-halfdayMatt training-html-halfday
Matt training-html-halfday
 

Mehr von MasterCode.vn

Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vn
Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vnPd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vn
Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vnMasterCode.vn
 
Why apps-succeed-wpr-mastercode.vn
Why apps-succeed-wpr-mastercode.vnWhy apps-succeed-wpr-mastercode.vn
Why apps-succeed-wpr-mastercode.vnMasterCode.vn
 
Dzone performancemonitoring2016-mastercode.vn
Dzone performancemonitoring2016-mastercode.vnDzone performancemonitoring2016-mastercode.vn
Dzone performancemonitoring2016-mastercode.vnMasterCode.vn
 
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vn
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vnGoogle công bố thông tin lịch xu hướng ngành 2017 mastercode.vn
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vnMasterCode.vn
 
Nghiên cứu về khách hàng mastercode.vn
Nghiên cứu về khách hàng mastercode.vnNghiên cứu về khách hàng mastercode.vn
Nghiên cứu về khách hàng mastercode.vnMasterCode.vn
 
Lập trình sáng tạo creative computing textbook mastercode.vn
Lập trình sáng tạo creative computing textbook mastercode.vnLập trình sáng tạo creative computing textbook mastercode.vn
Lập trình sáng tạo creative computing textbook mastercode.vnMasterCode.vn
 
Pd fbuoi7 8--tongquanseo-mastercode.vn
Pd fbuoi7 8--tongquanseo-mastercode.vnPd fbuoi7 8--tongquanseo-mastercode.vn
Pd fbuoi7 8--tongquanseo-mastercode.vnMasterCode.vn
 
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vnPd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vnMasterCode.vn
 
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vnPdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vnMasterCode.vn
 
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vnPd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vnMasterCode.vn
 
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vn
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vnPd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vn
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vnMasterCode.vn
 
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vn
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vnPd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vn
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vnMasterCode.vn
 
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vn
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vnPdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vn
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vnMasterCode.vn
 
Pdfbài 7 máy tính xác tay và máy in bảo trì sự cố máy tính-mastercode.vn
Pdfbài 7 máy tính xác tay và máy in   bảo trì sự cố máy tính-mastercode.vnPdfbài 7 máy tính xác tay và máy in   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 7 máy tính xác tay và máy in bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 
Pdfbài 6 bảo trì máy tính bảo trì sự cố máy tính-mastercode.vn
Pdfbài 6 bảo trì máy tính   bảo trì sự cố máy tính-mastercode.vnPdfbài 6 bảo trì máy tính   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 6 bảo trì máy tính bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 
Pdfbài 5 bảo trì và tối ưu windows bảo trì sự cố máy tính-mastercode.vn
Pdfbài 5 bảo trì và tối ưu windows   bảo trì sự cố máy tính-mastercode.vnPdfbài 5 bảo trì và tối ưu windows   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 5 bảo trì và tối ưu windows bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 
Pdfbài 4 ổ cứng hard drive bảo trì sự cố máy tính-mastercode.vn
Pdfbài 4 ổ cứng hard drive   bảo trì sự cố máy tính-mastercode.vnPdfbài 4 ổ cứng hard drive   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 4 ổ cứng hard drive bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 
Pdfbài 3 cpu và ram bảo trì sự cố máy tính-mastercode.vn
Pdfbài 3 cpu và ram   bảo trì sự cố máy tính-mastercode.vnPdfbài 3 cpu và ram   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 3 cpu và ram bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 
Pdfbài 1 giới thiệu chung về phần cứng bảo trì sự cố máy tính-mastercode.vn
Pdfbài 1 giới thiệu chung về phần cứng   bảo trì sự cố máy tính-mastercode.vnPdfbài 1 giới thiệu chung về phần cứng   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 1 giới thiệu chung về phần cứng bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 
Pdfbài 2 bo mạch chủ (main) bảo trì sự cố máy tính-mastercode.vn
Pdfbài 2 bo mạch chủ (main)   bảo trì sự cố máy tính-mastercode.vnPdfbài 2 bo mạch chủ (main)   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 2 bo mạch chủ (main) bảo trì sự cố máy tính-mastercode.vnMasterCode.vn
 

Mehr von MasterCode.vn (20)

Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vn
Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vnPd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vn
Pd ftai lieu-tieng-anh-cho-nguoi-moi-bat-dau-mastercode.vn
 
Why apps-succeed-wpr-mastercode.vn
Why apps-succeed-wpr-mastercode.vnWhy apps-succeed-wpr-mastercode.vn
Why apps-succeed-wpr-mastercode.vn
 
Dzone performancemonitoring2016-mastercode.vn
Dzone performancemonitoring2016-mastercode.vnDzone performancemonitoring2016-mastercode.vn
Dzone performancemonitoring2016-mastercode.vn
 
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vn
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vnGoogle công bố thông tin lịch xu hướng ngành 2017 mastercode.vn
Google công bố thông tin lịch xu hướng ngành 2017 mastercode.vn
 
Nghiên cứu về khách hàng mastercode.vn
Nghiên cứu về khách hàng mastercode.vnNghiên cứu về khách hàng mastercode.vn
Nghiên cứu về khách hàng mastercode.vn
 
Lập trình sáng tạo creative computing textbook mastercode.vn
Lập trình sáng tạo creative computing textbook mastercode.vnLập trình sáng tạo creative computing textbook mastercode.vn
Lập trình sáng tạo creative computing textbook mastercode.vn
 
Pd fbuoi7 8--tongquanseo-mastercode.vn
Pd fbuoi7 8--tongquanseo-mastercode.vnPd fbuoi7 8--tongquanseo-mastercode.vn
Pd fbuoi7 8--tongquanseo-mastercode.vn
 
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vnPd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
Pd fbuoi5 6-ảnh hưởng của social media tới kết quả seo-mastercode.vn
 
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vnPdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
Pdf buoi3 4-link-building-tran-ngoc-chinh-mastercode.vn
 
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vnPd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
Pd fbuoi3 4-kỹ thuật xây dựng back link-mastercode.vn
 
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vn
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vnPd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vn
Pd fbuoi2 onpage – tối ưu hóa trang web-mastercode.vn
 
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vn
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vnPd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vn
Pd fbuoi1 giới thiệu seo tools cơ bản-seo manager + seo guy-mastercode.vn
 
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vn
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vnPdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vn
Pdf buoi1 2-on-page-tran-ngoc-chinh-mastercode.vn
 
Pdfbài 7 máy tính xác tay và máy in bảo trì sự cố máy tính-mastercode.vn
Pdfbài 7 máy tính xác tay và máy in   bảo trì sự cố máy tính-mastercode.vnPdfbài 7 máy tính xác tay và máy in   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 7 máy tính xác tay và máy in bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 6 bảo trì máy tính bảo trì sự cố máy tính-mastercode.vn
Pdfbài 6 bảo trì máy tính   bảo trì sự cố máy tính-mastercode.vnPdfbài 6 bảo trì máy tính   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 6 bảo trì máy tính bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 5 bảo trì và tối ưu windows bảo trì sự cố máy tính-mastercode.vn
Pdfbài 5 bảo trì và tối ưu windows   bảo trì sự cố máy tính-mastercode.vnPdfbài 5 bảo trì và tối ưu windows   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 5 bảo trì và tối ưu windows bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 4 ổ cứng hard drive bảo trì sự cố máy tính-mastercode.vn
Pdfbài 4 ổ cứng hard drive   bảo trì sự cố máy tính-mastercode.vnPdfbài 4 ổ cứng hard drive   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 4 ổ cứng hard drive bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 3 cpu và ram bảo trì sự cố máy tính-mastercode.vn
Pdfbài 3 cpu và ram   bảo trì sự cố máy tính-mastercode.vnPdfbài 3 cpu và ram   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 3 cpu và ram bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 1 giới thiệu chung về phần cứng bảo trì sự cố máy tính-mastercode.vn
Pdfbài 1 giới thiệu chung về phần cứng   bảo trì sự cố máy tính-mastercode.vnPdfbài 1 giới thiệu chung về phần cứng   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 1 giới thiệu chung về phần cứng bảo trì sự cố máy tính-mastercode.vn
 
Pdfbài 2 bo mạch chủ (main) bảo trì sự cố máy tính-mastercode.vn
Pdfbài 2 bo mạch chủ (main)   bảo trì sự cố máy tính-mastercode.vnPdfbài 2 bo mạch chủ (main)   bảo trì sự cố máy tính-mastercode.vn
Pdfbài 2 bo mạch chủ (main) bảo trì sự cố máy tính-mastercode.vn
 

Kürzlich hochgeladen

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
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
 
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
 
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
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
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
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
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
 
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
 
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
 
"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
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
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
 
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
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
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
 

Kürzlich hochgeladen (20)

Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
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
 
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
 
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)
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 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
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
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
 
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
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
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.
 
"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
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
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!
 
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
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
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?
 

4 whats-new-in-ios7-m4-multitasking-slides

  • 1. What’s new in iOS7 Networking and Multi-tasking Jon Flanders @jonflanders Tuesday, September 3, 13
  • 2. What you will learn... Tuesday, September 3, 13
  • 3. What you will learn... § All about the new options for multi-tasking and background execution Tuesday, September 3, 13
  • 5. Background Tasks § Ever since iOS4, apps could request extra time to execute after being sent to the background Tuesday, September 3, 13
  • 6. Background Tasks § Ever since iOS4, apps could request extra time to execute after being sent to the background o 15 minutes of execution time Tuesday, September 3, 13
  • 7. Background Tasks § Ever since iOS4, apps could request extra time to execute after being sent to the background o 15 minutes of execution time § This API remains in iOS7, but you may not need to use it (more on this later) Tuesday, September 3, 13
  • 8. Background Tasks § Ever since iOS4, apps could request extra time to execute after being sent to the background o 15 minutes of execution time § This API remains in iOS7, but you may not need to use it (more on this later) § If you do use it, the execution semantics have changed Tuesday, September 3, 13
  • 9. Background Tasks § Ever since iOS4, apps could request extra time to execute after being sent to the background o 15 minutes of execution time § This API remains in iOS7, but you may not need to use it (more on this later) § If you do use it, the execution semantics have changed o If user locked screen in iOS6, the background task would keep the phone awake Tuesday, September 3, 13
  • 10. Background Tasks § Ever since iOS4, apps could request extra time to execute after being sent to the background o 15 minutes of execution time § This API remains in iOS7, but you may not need to use it (more on this later) § If you do use it, the execution semantics have changed o o If user locked screen in iOS6, the background task would keep the phone awake iOS7 puts the app to sleep; the app will get a time-slice once the phone wakes up Tuesday, September 3, 13
  • 11. Background Tasks § Ever since iOS4, apps could request extra time to execute after being sent to the background o 15 minutes of execution time § This API remains in iOS7, but you may not need to use it (more on this later) § If you do use it, the execution semantics have changed o o o If user locked screen in iOS6, the background task would keep the phone awake iOS7 puts the app to sleep; the app will get a time-slice once the phone wakes up Execution time not guaranteed to be contiguous Tuesday, September 3, 13
  • 12. New App Switcher Tuesday, September 3, 13
  • 13. New App Switcher § One of the major changes in the OS Tuesday, September 3, 13
  • 14. New App Switcher § One of the major changes in the OS § User can swipe up on app snapshot to kill the app Tuesday, September 3, 13
  • 15. New App Switcher § One of the major changes in the OS § User can swipe up on app snapshot to kill the app o Unlike in iOS6, this also kills background execution Tuesday, September 3, 13
  • 17. New APIs § Background Fetch Tuesday, September 3, 13
  • 18. New APIs § Background Fetch § Remote Notifications Tuesday, September 3, 13
  • 19. New APIs § Background Fetch § Remote Notifications § Background Transfer Service Tuesday, September 3, 13
  • 21. Background Fetch § When an app opens, typically it shows fresh data Tuesday, September 3, 13
  • 22. Background Fetch § When an app opens, typically it shows fresh data § When an app is brought to the foreground after being in the background, generally the first thing most apps do is refresh their data Tuesday, September 3, 13
  • 23. Background Fetch § When an app opens, typically it shows fresh data § When an app is brought to the foreground after being in the background, generally the first thing most apps do is refresh their data o But update happens after the user is already in the app, so the user sees a transition Tuesday, September 3, 13
  • 24. Background Fetch § When an app opens, typically it shows fresh data § When an app is brought to the foreground after being in the background, generally the first thing most apps do is refresh their data o But update happens after the user is already in the app, so the user sees a transition § Background Fetch enables an app to update its data in the background Tuesday, September 3, 13
  • 25. Background Fetch § When an app opens, typically it shows fresh data § When an app is brought to the foreground after being in the background, generally the first thing most apps do is refresh their data o But update happens after the user is already in the app, so the user sees a transition § Background Fetch enables an app to update its data in the background o If an app is in the background, it will be assigned a time-slice Tuesday, September 3, 13
  • 26. Background Fetch § When an app opens, typically it shows fresh data § When an app is brought to the foreground after being in the background, generally the first thing most apps do is refresh their data o But update happens after the user is already in the app, so the user sees a transition § Background Fetch enables an app to update its data in the background o o If an app is in the background, it will be assigned a time-slice If an app isn’t running, it will be started in the background and then assigned a timeslice Tuesday, September 3, 13
  • 27. Background Fetch § When an app opens, typically it shows fresh data § When an app is brought to the foreground after being in the background, generally the first thing most apps do is refresh their data o But update happens after the user is already in the app, so the user sees a transition § Background Fetch enables an app to update its data in the background o o o If an app is in the background, it will be assigned a time-slice If an app isn’t running, it will be started in the background and then assigned a timeslice When and how often the app is assigned a time-slice is controlled by the OS Tuesday, September 3, 13
  • 28. Background Fetch API Tuesday, September 3, 13
  • 29. Background Fetch API § Set the UIBackgroundModes value in the Info.plist to “fetch” Tuesday, September 3, 13
  • 30. Background Fetch API § Set the UIBackgroundModes value in the Info.plist to “fetch” o This can also be set this via the new Capabilities page in Xcode Tuesday, September 3, 13
  • 31. Background Fetch API § Set the UIBackgroundModes value in the Info.plist to “fetch” o This can also be set this via the new Capabilities page in Xcode § Set the background fetch interval range on your Application object Tuesday, September 3, 13
  • 32. Background Fetch API § Set the UIBackgroundModes value in the Info.plist to “fetch” o This can also be set this via the new Capabilities page in Xcode § Set the background fetch interval range on your Application object o No repeating interval Tuesday, September 3, 13
  • 33. Background Fetch API § Set the UIBackgroundModes value in the Info.plist to “fetch” o This can also be set this via the new Capabilities page in Xcode § Set the background fetch interval range on your Application object o o No repeating interval Time-slice assignment is managed by the OS, the range is set by the developer Tuesday, September 3, 13
  • 34. Background Fetch API § Set the UIBackgroundModes value in the Info.plist to “fetch” o This can also be set this via the new Capabilities page in Xcode § Set the background fetch interval range on your Application object o o No repeating interval Time-slice assignment is managed by the OS, the range is set by the developer § New delegate callback Tuesday, September 3, 13
  • 35. Background Fetch API § Set the UIBackgroundModes value in the Info.plist to “fetch” o This can also be set this via the new Capabilities page in Xcode § Set the background fetch interval range on your Application object o o No repeating interval Time-slice assignment is managed by the OS, the range is set by the developer § New delegate callback o performFetchWithCompletionHandler Tuesday, September 3, 13
  • 36. Background Fetch API § Set the UIBackgroundModes value in the Info.plist to “fetch” o This can also be set this via the new Capabilities page in Xcode § Set the background fetch interval range on your Application object o o No repeating interval Time-slice assignment is managed by the OS, the range is set by the developer § New delegate callback o o performFetchWithCompletionHandler Do your work: call the completion handler when you are done Tuesday, September 3, 13
  • 37. Background Fetch API § Set the UIBackgroundModes value in the Info.plist to “fetch” o This can also be set this via the new Capabilities page in Xcode § Set the background fetch interval range on your Application object o o No repeating interval Time-slice assignment is managed by the OS, the range is set by the developer § New delegate callback o o o performFetchWithCompletionHandler Do your work: call the completion handler when you are done After the completion handler is called, if you have new data, it will create a new snapshot of your app Tuesday, September 3, 13
  • 38. Background Fetch API § Set the UIBackgroundModes value in the Info.plist to “fetch” o This can also be set this via the new Capabilities page in Xcode § Set the background fetch interval range on your Application object o o No repeating interval Time-slice assignment is managed by the OS, the range is set by the developer § New delegate callback o o o performFetchWithCompletionHandler Do your work: call the completion handler when you are done After the completion handler is called, if you have new data, it will create a new snapshot of your app § Update UI for App Switcher Tuesday, September 3, 13
  • 39. Background Fetch API § Set the UIBackgroundModes value in the Info.plist to “fetch” o This can also be set this via the new Capabilities page in Xcode § Set the background fetch interval range on your Application object o o No repeating interval Time-slice assignment is managed by the OS, the range is set by the developer § New delegate callback o o o performFetchWithCompletionHandler Do your work: call the completion handler when you are done After the completion handler is called, if you have new data, it will create a new snapshot of your app § Update UI for App Switcher § You can test this via debug properties Tuesday, September 3, 13
  • 40. Background Fetch API § Set the UIBackgroundModes value in the Info.plist to “fetch” o This can also be set this via the new Capabilities page in Xcode § Set the background fetch interval range on your Application object o o No repeating interval Time-slice assignment is managed by the OS, the range is set by the developer § New delegate callback o o o performFetchWithCompletionHandler Do your work: call the completion handler when you are done After the completion handler is called, if you have new data, it will create a new snapshot of your app § Update UI for App Switcher § You can test this via debug properties o Also on Debug menu Tuesday, September 3, 13
  • 42. Remote Notifications § Since iOS4, notifications could be sent through Apple’s Push Notification Service (APNS) Tuesday, September 3, 13
  • 43. Remote Notifications § Since iOS4, notifications could be sent through Apple’s Push Notification Service (APNS) § Often sent to notify user of new data Tuesday, September 3, 13
  • 44. Remote Notifications § Since iOS4, notifications could be sent through Apple’s Push Notification Service (APNS) § Often sent to notify user of new data o User is notified via alert or popup Tuesday, September 3, 13
  • 45. Remote Notifications § Since iOS4, notifications could be sent through Apple’s Push Notification Service (APNS) § Often sent to notify user of new data o o User is notified via alert or popup If the user clicked on UI, the app was either brought to foreground or started Tuesday, September 3, 13
  • 46. Remote Notifications § Since iOS4, notifications could be sent through Apple’s Push Notification Service (APNS) § Often sent to notify user of new data o o o User is notified via alert or popup If the user clicked on UI, the app was either brought to foreground or started Race condition: what if app can’t show new data yet because new data can’t even start to be retrieved until app is in the foreground Tuesday, September 3, 13
  • 47. Remote Notifications § Since iOS4, notifications could be sent through Apple’s Push Notification Service (APNS) § Often sent to notify user of new data o o o User is notified via alert or popup If the user clicked on UI, the app was either brought to foreground or started Race condition: what if app can’t show new data yet because new data can’t even start to be retrieved until app is in the foreground § iOS7 enables you to send a notification with a new flag Tuesday, September 3, 13
  • 48. Remote Notifications § Since iOS4, notifications could be sent through Apple’s Push Notification Service (APNS) § Often sent to notify user of new data o o o User is notified via alert or popup If the user clicked on UI, the app was either brought to foreground or started Race condition: what if app can’t show new data yet because new data can’t even start to be retrieved until app is in the foreground § iOS7 enables you to send a notification with a new flag o content-available : 1 Tuesday, September 3, 13
  • 49. Remote Notifications § Since iOS4, notifications could be sent through Apple’s Push Notification Service (APNS) § Often sent to notify user of new data o o o User is notified via alert or popup If the user clicked on UI, the app was either brought to foreground or started Race condition: what if app can’t show new data yet because new data can’t even start to be retrieved until app is in the foreground § iOS7 enables you to send a notification with a new flag o o content-available : 1 When set, the app gets executed before the user gets the notification Tuesday, September 3, 13
  • 50. Remote Notifications § Since iOS4, notifications could be sent through Apple’s Push Notification Service (APNS) § Often sent to notify user of new data o o o User is notified via alert or popup If the user clicked on UI, the app was either brought to foreground or started Race condition: what if app can’t show new data yet because new data can’t even start to be retrieved until app is in the foreground § iOS7 enables you to send a notification with a new flag o o o content-available : 1 When set, the app gets executed before the user gets the notification Hopefully you can get that new data before the user clicks the alert to bring the app to the foreground Tuesday, September 3, 13
  • 51. Remote Notifications § Since iOS4, notifications could be sent through Apple’s Push Notification Service (APNS) § Often sent to notify user of new data o o o User is notified via alert or popup If the user clicked on UI, the app was either brought to foreground or started Race condition: what if app can’t show new data yet because new data can’t even start to be retrieved until app is in the foreground § iOS7 enables you to send a notification with a new flag o o o content-available : 1 When set, the app gets executed before the user gets the notification Hopefully you can get that new data before the user clicks the alert to bring the app to the foreground § Send content-available:1 without an alert in the payload of the notification Tuesday, September 3, 13
  • 52. Remote Notifications § Since iOS4, notifications could be sent through Apple’s Push Notification Service (APNS) § Often sent to notify user of new data o o o User is notified via alert or popup If the user clicked on UI, the app was either brought to foreground or started Race condition: what if app can’t show new data yet because new data can’t even start to be retrieved until app is in the foreground § iOS7 enables you to send a notification with a new flag o o o content-available : 1 When set, the app gets executed before the user gets the notification Hopefully you can get that new data before the user clicks the alert to bring the app to the foreground § Send content-available:1 without an alert in the payload of the notification o This becomes a silent notification and is delivered to the app in the background Tuesday, September 3, 13
  • 54. Remote Notifications API § Set UIBackgroundModes to remote-notification in Info.plist Tuesday, September 3, 13
  • 55. Remote Notifications API § Set UIBackgroundModes to remote-notification in Info.plist o Or use new Capabilities UI in Xcode Tuesday, September 3, 13
  • 56. Remote Notifications API § Set UIBackgroundModes to remote-notification in Info.plist o Or use new Capabilities UI in Xcode § Make sure to set content-available: 1 in the payload Tuesday, September 3, 13
  • 57. Remote Notifications API § Set UIBackgroundModes to remote-notification in Info.plist o Or use new Capabilities UI in Xcode § Make sure to set content-available: 1 in the payload § The application:didReceiveRemoteNotification:fetchCompletionHandler is called with a non-null completion handler Tuesday, September 3, 13
  • 58. Remote Notifications API § Set UIBackgroundModes to remote-notification in Info.plist o Or use new Capabilities UI in Xcode § Make sure to set content-available: 1 in the payload § The application:didReceiveRemoteNotification:fetchCompletionHandler is called with a non-null completion handler o Call the completion handler when you are done Tuesday, September 3, 13
  • 59. Remote Notifications API § Set UIBackgroundModes to remote-notification in Info.plist o Or use new Capabilities UI in Xcode § Make sure to set content-available: 1 in the payload § The application:didReceiveRemoteNotification:fetchCompletionHandler is called with a non-null completion handler o o Call the completion handler when you are done Silent notifications will be rate-limited. APNS does the work to make sure that device isn’t overloaded – delayed but not rejected Tuesday, September 3, 13
  • 60. Networking in the Background Tuesday, September 3, 13
  • 61. Networking in the Background § Before iOS7, you might want to download or upload a resource after the your app has gone to the background Tuesday, September 3, 13
  • 62. Networking in the Background § Before iOS7, you might want to download or upload a resource after the your app has gone to the background § Background Task API would give you a set time-slice Tuesday, September 3, 13
  • 63. Networking in the Background § Before iOS7, you might want to download or upload a resource after the your app has gone to the background § Background Task API would give you a set time-slice o What if your operation took longer than the time allowed (i.e. a large resource like a video or image)? Tuesday, September 3, 13
  • 64. Background Transfer Service (BTS) Tuesday, September 3, 13
  • 65. Background Transfer Service (BTS) § iOS7 introduces the BTS Tuesday, September 3, 13
  • 66. Background Transfer Service (BTS) § iOS7 introduces the BTS § You can offload network work to the BTS Tuesday, September 3, 13
  • 67. Background Transfer Service (BTS) § iOS7 introduces the BTS § You can offload network work to the BTS § BTS will ensure that the work gets completed Tuesday, September 3, 13
  • 68. Background Transfer Service (BTS) § iOS7 introduces the BTS § You can offload network work to the BTS § BTS will ensure that the work gets completed o Works even if your app is in the background or even if it is terminated Tuesday, September 3, 13
  • 69. Background Transfer Service (BTS) § iOS7 introduces the BTS § You can offload network work to the BTS § BTS will ensure that the work gets completed o o Works even if your app is in the background or even if it is terminated If your app wakes up due to background fetch or notification, this is a great API to pair with it Tuesday, September 3, 13
  • 70. Background Transfer Service (BTS) § iOS7 introduces the BTS § You can offload network work to the BTS § BTS will ensure that the work gets completed o o Works even if your app is in the background or even if it is terminated If your app wakes up due to background fetch or notification, this is a great API to pair with it § BTS manages battery life and data Tuesday, September 3, 13
  • 71. Background Transfer Service (BTS) § iOS7 introduces the BTS § You can offload network work to the BTS § BTS will ensure that the work gets completed o o Works even if your app is in the background or even if it is terminated If your app wakes up due to background fetch or notification, this is a great API to pair with it § BTS manages battery life and data o Requests are classified as discretionary or non-discretionary Tuesday, September 3, 13
  • 72. Background Transfer Service (BTS) § iOS7 introduces the BTS § You can offload network work to the BTS § BTS will ensure that the work gets completed o o Works even if your app is in the background or even if it is terminated If your app wakes up due to background fetch or notification, this is a great API to pair with it § BTS manages battery life and data o o Requests are classified as discretionary or non-discretionary Discretionary requests will only happen when on WI-FI Tuesday, September 3, 13
  • 73. Background Transfer Service (BTS) § iOS7 introduces the BTS § You can offload network work to the BTS § BTS will ensure that the work gets completed o o Works even if your app is in the background or even if it is terminated If your app wakes up due to background fetch or notification, this is a great API to pair with it § BTS manages battery life and data o o o Requests are classified as discretionary or non-discretionary Discretionary requests will only happen when on WI-FI Requests from the background are automatically discretionary Tuesday, September 3, 13
  • 74. Background Transfer Service (BTS) § iOS7 introduces the BTS § You can offload network work to the BTS § BTS will ensure that the work gets completed o o Works even if your app is in the background or even if it is terminated If your app wakes up due to background fetch or notification, this is a great API to pair with it § BTS manages battery life and data o o o o Requests are classified as discretionary or non-discretionary Discretionary requests will only happen when on WI-FI Requests from the background are automatically discretionary Requests from the foreground can request to be discretionary Tuesday, September 3, 13
  • 76. NSURLSession § New object in iOS7 Tuesday, September 3, 13
  • 77. NSURLSession § New object in iOS7 § Subsumes the functionality of NSURLConnection Tuesday, September 3, 13
  • 78. NSURLSession § New object in iOS7 § Subsumes the functionality of NSURLConnection o API is similar to NSURLConnection Tuesday, September 3, 13
  • 79. NSURLSession § New object in iOS7 § Subsumes the functionality of NSURLConnection o API is similar to NSURLConnection § Adds more functionality than NSURLConnection Tuesday, September 3, 13
  • 80. NSURLSession § New object in iOS7 § Subsumes the functionality of NSURLConnection o API is similar to NSURLConnection § Adds more functionality than NSURLConnection o Instance storage of credentials, cookies, and other state (vs. NSURLConnection’s global shared state). Tuesday, September 3, 13
  • 81. NSURLSession § New object in iOS7 § Subsumes the functionality of NSURLConnection o API is similar to NSURLConnection § Adds more functionality than NSURLConnection o Instance storage of credentials, cookies, and other state (vs. NSURLConnection’s global shared state). § If your app goes to the background or even is terminated after you make a NSURLSession request, BTS service will still complete the request Tuesday, September 3, 13
  • 82. NSURLSession § New object in iOS7 § Subsumes the functionality of NSURLConnection o API is similar to NSURLConnection § Adds more functionality than NSURLConnection o Instance storage of credentials, cookies, and other state (vs. NSURLConnection’s global shared state). § If your app goes to the background or even is terminated after you make a NSURLSession request, BTS service will still complete the request o Your app is started or woken up when request is finished and you have a chance to process Tuesday, September 3, 13
  • 84. NSURLSession API § To create an NSURLSession, you need an NSURLSessionConfiguration object Tuesday, September 3, 13
  • 85. NSURLSession API § To create an NSURLSession, you need an NSURLSessionConfiguration object o Configuration object determines foreground/background execution, whether the request will use only wi-fi, etc. Tuesday, September 3, 13
  • 86. NSURLSession API § To create an NSURLSession, you need an NSURLSessionConfiguration object o o Configuration object determines foreground/background execution, whether the request will use only wi-fi, etc. Background configuration gets an identifier (string) to use later to retrieve from BTS Tuesday, September 3, 13
  • 87. NSURLSession API § To create an NSURLSession, you need an NSURLSessionConfiguration object o o Configuration object determines foreground/background execution, whether the request will use only wi-fi, etc. Background configuration gets an identifier (string) to use later to retrieve from BTS § Implement to appropriate protocols Tuesday, September 3, 13
  • 88. NSURLSession API § To create an NSURLSession, you need an NSURLSessionConfiguration object o o Configuration object determines foreground/background execution, whether the request will use only wi-fi, etc. Background configuration gets an identifier (string) to use later to retrieve from BTS § Implement to appropriate protocols o NSURLSessionDelegate for high-level events Tuesday, September 3, 13
  • 89. NSURLSession API § To create an NSURLSession, you need an NSURLSessionConfiguration object o o Configuration object determines foreground/background execution, whether the request will use only wi-fi, etc. Background configuration gets an identifier (string) to use later to retrieve from BTS § Implement to appropriate protocols o o NSURLSessionDelegate for high-level events NSURLSessionTaskDelegate for data-level events Tuesday, September 3, 13
  • 90. NSURLSession API § To create an NSURLSession, you need an NSURLSessionConfiguration object o o Configuration object determines foreground/background execution, whether the request will use only wi-fi, etc. Background configuration gets an identifier (string) to use later to retrieve from BTS § Implement to appropriate protocols o o NSURLSessionDelegate for high-level events NSURLSessionTaskDelegate for data-level events § NSURLSessionTask really replaces NSURLConnection Tuesday, September 3, 13
  • 91. NSURLSession API § To create an NSURLSession, you need an NSURLSessionConfiguration object o o Configuration object determines foreground/background execution, whether the request will use only wi-fi, etc. Background configuration gets an identifier (string) to use later to retrieve from BTS § Implement to appropriate protocols o o NSURLSessionDelegate for high-level events NSURLSessionTaskDelegate for data-level events § NSURLSessionTask really replaces NSURLConnection o [resume] method to start task Tuesday, September 3, 13
  • 92. NSURLSession API § To create an NSURLSession, you need an NSURLSessionConfiguration object o o Configuration object determines foreground/background execution, whether the request will use only wi-fi, etc. Background configuration gets an identifier (string) to use later to retrieve from BTS § Implement to appropriate protocols o o NSURLSessionDelegate for high-level events NSURLSessionTaskDelegate for data-level events § NSURLSessionTask really replaces NSURLConnection o o [resume] method to start task [cancel],[suspend],[resume] control methods Tuesday, September 3, 13
  • 93. NSURLSession API § To create an NSURLSession, you need an NSURLSessionConfiguration object o o Configuration object determines foreground/background execution, whether the request will use only wi-fi, etc. Background configuration gets an identifier (string) to use later to retrieve from BTS § Implement to appropriate protocols o o NSURLSessionDelegate for high-level events NSURLSessionTaskDelegate for data-level events § NSURLSessionTask really replaces NSURLConnection o o o [resume] method to start task [cancel],[suspend],[resume] control methods Multiple sub-classes for different functions Tuesday, September 3, 13
  • 94. NSURLSession API § To create an NSURLSession, you need an NSURLSessionConfiguration object o o Configuration object determines foreground/background execution, whether the request will use only wi-fi, etc. Background configuration gets an identifier (string) to use later to retrieve from BTS § Implement to appropriate protocols o o NSURLSessionDelegate for high-level events NSURLSessionTaskDelegate for data-level events § NSURLSessionTask really replaces NSURLConnection o o o [resume] method to start task [cancel],[suspend],[resume] control methods Multiple sub-classes for different functions § NSURLSession also has block-based convenience methods as well Tuesday, September 3, 13
  • 95. NSURLSession API § To create an NSURLSession, you need an NSURLSessionConfiguration object o o Configuration object determines foreground/background execution, whether the request will use only wi-fi, etc. Background configuration gets an identifier (string) to use later to retrieve from BTS § Implement to appropriate protocols o o NSURLSessionDelegate for high-level events NSURLSessionTaskDelegate for data-level events § NSURLSessionTask really replaces NSURLConnection o o o [resume] method to start task [cancel],[suspend],[resume] control methods Multiple sub-classes for different functions § NSURLSession also has block-based convenience methods as well o Still need to call [resume] on task to kick off connection Tuesday, September 3, 13
  • 97. Background Considerations § Limited time Tuesday, September 3, 13
  • 98. Background Considerations § Limited time o You still only get a limited time to execute in the background (less than 1 minute) Tuesday, September 3, 13
  • 99. Background Considerations § Limited time o o You still only get a limited time to execute in the background (less than 1 minute) Make sure to call the completion handlers ALWAYS in less than 1 minute Tuesday, September 3, 13
  • 100. Background Considerations § Limited time o o o You still only get a limited time to execute in the background (less than 1 minute) Make sure to call the completion handlers ALWAYS in less than 1 minute Use BTS to enhance the work you can do when called in the background Tuesday, September 3, 13
  • 101. Background Considerations § Limited time o o o You still only get a limited time to execute in the background (less than 1 minute) Make sure to call the completion handlers ALWAYS in less than 1 minute Use BTS to enhance the work you can do when called in the background § User control Tuesday, September 3, 13
  • 102. Background Considerations § Limited time o o o You still only get a limited time to execute in the background (less than 1 minute) Make sure to call the completion handlers ALWAYS in less than 1 minute Use BTS to enhance the work you can do when called in the background § User control o User can turn off or limit background fetch Tuesday, September 3, 13
  • 103. Background Considerations § Limited time o o o You still only get a limited time to execute in the background (less than 1 minute) Make sure to call the completion handlers ALWAYS in less than 1 minute Use BTS to enhance the work you can do when called in the background § User control o User can turn off or limit background fetch § Data Protection Tuesday, September 3, 13
  • 104. Background Considerations § Limited time o o o You still only get a limited time to execute in the background (less than 1 minute) Make sure to call the completion handlers ALWAYS in less than 1 minute Use BTS to enhance the work you can do when called in the background § User control o User can turn off or limit background fetch § Data Protection o If you use the recommended levels of data protection, you won’t be able to access files, keychain, or sqlite DBs when running in the background Tuesday, September 3, 13
  • 105. Background Considerations § Limited time o o o You still only get a limited time to execute in the background (less than 1 minute) Make sure to call the completion handlers ALWAYS in less than 1 minute Use BTS to enhance the work you can do when called in the background § User control o User can turn off or limit background fetch § Data Protection o o If you use the recommended levels of data protection, you won’t be able to access files, keychain, or sqlite DBs when running in the background If you need credentials in the background, to lower risk, consider a token that expires in a short amount of time Tuesday, September 3, 13
  • 107. Summary § The new background execution features help your app seem to the user to be running all the time Tuesday, September 3, 13
  • 108. Summary § The new background execution features help your app seem to the user to be running all the time § The new NSURLSession and BTS make foreground networking code simpler and background networking code possible Tuesday, September 3, 13