iOS7

What's New

What's new


  • New UI
    • Control & Notification Center
    • AirDrop
    • Others
  • New Features
    • Multitasking
    • Multipeer Connectivity
    • Web
  • Tools
    • Xcode

New UI

- Control / Notification


New UI

- Airdrop


new ui



new ui

- Home screen

new ui

- Folder

new ui

- Message & Keyboard

new ui

- Phone

new ui

- Incoming phone call

new ui

- Search

new ui

- Settings

New ui

- Weather

new ui

- Game Center

new ui

- Clock

new ui

- Compass

new ui

- Calendar

new ui

- Notes

new ui

- Stocks

new ui

- Calculator

new UI

- AppStore

new ui

- Sharing


new ui

- ActionSheet

new ui

- Siri

new ui



multitasking


  • App Switcher
  • iOS6 & iOS7
  • Background fetching
  • Remote notification
  • Background transfers

Multitasking

- App Switcher

multitasking

- iOS6 & iOS7

multitasking

- Background fetching

audio, location, voip, ..., fetch
                        - (void)application:(UIApplication *)application
performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result)) completionHandler
  • UIBackgroundFetchResultNewData / NoData / Failed

fetch interval
 - (void)setMinimumBackgroundFetchInterval:(NSTimeInterval)minInterval;
  • UIApplicationBackgroundFetchIntervalMinimum
  • UIApplicationBackgroundFetchIntervalNever

multitasking

- Background fetching

... your app has up to 30 seconds of wall-clock time to perform the download operation and call the specified completion handler block ...


... the system uses the elapsed time to calculate power usage and data costs for your app’s background downloads. If your app takes a long time to call the completion handler, it may be given fewer future opportunities to fetch data in the future ...

multitasking

- Remote notifications

audio, location, voip, ..., fetch, remote-notification
              - (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
       fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result)) completionHandler;

  • before remote notification is displayed
  • regardless of the state of your app
  • your app has up to 30 seconds

Multitasking

- Background transfers

multitasking

- Background transfers

                            - (void)application:(UIApplication *)application
handleEventForBackgroundURLSession:(NSString *)identifier
                           completionHandler:(void (^)())completionHandler;
Video Demo

see more details about NSURLSession
<What's New in Foundation Networking>

multipeer connectivity

- With WiFi & Bluetooth

Multipeer connectivity


  • Discovery phase
  • Session phase
  • Programmatic discovery
  • Security

multipeer connectivity

- Terminology

  • Peer
  • Advertiser
  • Browser

multipeer connectivity

- Discovery phase

MULTIPEER CONNECTIVITY

- Discovery phase for Advertiser

//identify yourself
MCPeerID *myPeerID = [[MCPeerID alloc] initWithName:@"Oscar"];

//create a session
MCSession *session = [[MCSession alloc] initWithPeer:myPeerID];
session.delegate = self;

//start advertising yourself
MCAdvertiserAssistant *assistant = 
[[MCAdvertiserAssistant alloc] initWithServiceType:type discoveryInfo:nil session:session];
[assistant start];

MCSessionDelegate
//MCSessionStateNotConnected/Connecting/Connected)
session:peer:didChangeState: 

MULTIPEER CONNECTIVITY

- Discovery phase for Browser

MCBrowserViewController *browser = [[MCBrowserViewController] alloc] 
                                                           initWithServiceType:serviceType 
                                                           session:session];
browser.delegte = self;
[self presentViewController:browser animated:YES compiltion:nil];


MULTIPEER CONNECTIVITY

- Session phase
MCSession
- (BOOL)sendData:(NSData *)data
               toPeers:(NSArray *)peerIDs
            withMode:(MCSessionSendDataMode)mode
                   error:(NSError **)error

- (void)sendResourceAtURL:(NSURL *)resourceURL
                             toPeer:(NSArray *)peerIDs
                     withTimeout:(NSTimeInterval)timeout
              completionHandler:(void (^)(NSError *error))completehandler

- (NSOutputStream *)startStreamstartStreamWithName:(NSString *)streamName
                                                                  toPeer:(MCPeerID *)peerID
                                                                     error:(NSError **)error
MCSessionDelegate
session:didReceiveData:fromPeer:
session:didReceiveResourceAtURL:fromPeer:
session:didReceiveStream:withName:fromPeer:

MULTIPEER CONNECTIVITY

- Session phase

MCSessionSendDataMode
  • MCSessionSendDataReliable
    • Application critical data
    • Retransmissions
    • In order delivery
  • MCSessionSendDataUnreliable
    • Time sensitive data
    • No delivery guarantees
    • No order guarantees

multipeer connectivity

- Relay transmission

multipeer connectivity

- Disconnecting

[session disconnect];

multipeer connectivity

- Programmatic discovery

  • Advertising
  • Browsing
  • Inviting

MULTIPEER CONNECTIVITY

- Programmatic Advertising

MCNearbyServiceAdvertiser *advertiser = [[MCNearbyServiceAdvertiser alloc] 
                                                               initWithPeer:myPeerID 
                                                             discoveryInfo:info 
                                                               serviceType:type];
advertiser.delegate = self;
[advertiser startAdvertisingPeer];

MULTIPEER CONNECTIVITY

- Programmatic Browsing

MCNearbyServiceBrowser
MCNearbyServiceBrowser *browser = [[MCNearbyServiceBrowser alloc] 
                                                          initWithPeer:myPeerID 
                                                          serviceType:serviceType];
browser.delegate = self;
[browser startBrowsingForPeers];

MCNearbyServiceBrowserDelegate
    - (void)browser:(MCNearbyServiceBrowser *)browser
           foundPeer:(MCPeerID *)peerID
withDiscoveryInfo:(NSDictionary *)info

- (void)browser:(MCNearbyServiceBrowser *)browser lostPeer:(MCPeerID *)peerID

MULTIPEER CONNECTIVITY

- Send/Receive Invitation

MCNearbyServiceBrowser
[browser invitePeer:peerID toSession:session withContext:context timeout:timeout];

MCNearbyServiceAdvertiserDelegate
                - (void)advertiser:(MCNearbyServiceAdvertiser *)advertiser
didReceiveInvitationFromPeer:(MCPeerID *)peerID
                      withContext:(NSData *)context
                invitationHandler:(void (^)(BOOL accept, MCSession *session))invitationHandler

Web


  • Push Notification for Websites
  • Objective-C -- JavaScript

web

- Push Notification for Websites

  • Local vs Push
  • Subscribing
  • Unsubscribing
  • Delivering
  • Implementation

web

- Local vs Push

web

- Subscribing
The website "xxxx" would like to send you push notifications in Notification Center ...

web

- Unsubscribing

web

- Delivering

web

- Implementing Push Notification

  • Get website push certificate
  • Add support to your server
    • Query permission
    • Request permission
    • Write web service backend
    • Send push notification

web

- Get website push certificate

web

- Permission
Query Permission
//result.permission = "default"/"denied"/"granted"
//result.deviceToken = "...."
var result = window.safari.pushNotification.permission( websitePushID );
Request Permission
window.safari.pushNotification.requestPermission(
    webServiceURL,
    websitePushID,
    userInfo,
    callback
);

//if user confirms
callback({
    permission: "granted",
    deviceToken: "...."
});

web

- Service backend

web

- Send push notifications

{
    "aps": {
        "alert": {
            "title": "Flight A109 Gate Changed",
            "body": "Your gate has changed to A4",
            "action": "View"
        },
        "url-args": ["gate-change", "A109"]
    }
}

message payload <= 256 bytes

web

- Objective-C -- JavaScript

  • Objective-C > JavaScript
  • JavaScript > Objective-C

WEb

- JSBridge
                   

web

- Evaluating JS Code

#import <JavaScriptCore/JavaScriptCore.h>

int main(){
    JSContext *context = [[JSContext alloc] init];
    JSValue *result = [context evaluateScript:@"2+2"];
    NSLog(@"2+2=%d", [result toInt32]);
    
    return 0;
}

web

- Calling JS Functions

var factorial = function(n){
    if (n<0) return;
    if (n===0) return 1;
    return n * factorial(n-1);
};
NSString *factorialScript = ...;
[context evaluateScript:factorialScript];

JSValue *function = context[@"factorial"];
JSValue *result = [function callWithArguments:@[@5]];
NSLog(@"factorial(5) = %d", [result toInt32]);

web

- JavaScript > Objective-C

  • Blocks
    • js functions
  • JSExport protocol
    • js objects

web

- Blocks
context[@"makeNSColor"] = ^(NSDictionary *rgb){
    float r = [color[@"red"] floatValue];
    float g = [color[@"green"] floatValue];
    float b = [color[@"blue"] floatValue];
    return [NSColor colorWithRed:(r / 255.0f)
                                         green:(g / 255.0f)
                                           blue:(b / 255.0f)
                                         alpha:1.0f];
};
var makeColor = function(rgb) {
    return makrNSColor(rgb);
};

web

- JSExport

xcode


xcode

- Document


xcode

- Document

xcode

- Integrated Document

xcode

- Integrated Document

xcode

- Interface Design

xcode

- Automatically link frameworks


xcode

- Debugger

xcode

- Debugger

xcode

- Debugger

xcode

- Debugger

xcode

- Profile

xcode

- Energy consumption

xcode

- Bots



thanks

Made with Slides.com