Часть первая: Заявка на дизайн.
                   материал по сайту artlebedev.ru




  Андрей Соловей
Джон
Заказчик
Заказчик   Дизайнер
Заявка на дизайн
Шаг 1: Возникновение проблемы.
Шаг 2: Осознание проблемы обычными людьми.
Шаг 3: Попытка решить проблему подручными
средствами, до прихода дизайнера.
Шаг 4: Собственно, дизайнерское решение.
Прогресс

Шаг 1: Возникновение проблемы.


Шаг 2: Осознание проблемы обычными людьми.


Шаг 3: Попытка решить проблему подручными средствами, до прихода дизайнера.


Шаг 4: Собственно, дизайнерское решение.
Часть вторая: Многозадачность в iOS.
•   AirPlay
•   AirPlay
•   AirPrint
•   AirPlay
•   AirPrint
•   HTTP Live Streaming Statistics
•   AirPlay
•   AirPrint
•   HTTP Live Streaming Statistics
•   iAd
•   AirPlay
•   AirPrint
•   HTTP Live Streaming Statistics
•   iAd
•   Game Center
•   AirPlay
•   AirPrint
•   HTTP Live Streaming Statistics
•   iAd
•   Game Center
•   Multitasking
#import <sys/sysctl.h>
void printProcessInfo()
{
    int mib[5];
    struct kinfo_proc *procs = NULL, *newprocs;
    int i, st, nprocs;
    size_t miblen, size;

    mib[0]      =   CTL_KERN;                                     // Set up sysctl MIB
    mib[1]      =   KERN_PROC;
    mib[2]      =   KERN_PROC_ALL;
    mib[3]      =   0;
    miblen      =   4;

    st = sysctl(mib, miblen, NULL, &size, NULL, 0);              // Get initial sizing

    do                                                           // Repeat until we get them all …
    {
             size += size / 10;                                   // Room to grow
             newprocs = (struct kinfo_proc*)realloc(procs, size);
             if (!newprocs)
         {
                 if (procs)
                     free(procs);
                 NSLog(@"Error: realloc failed.");
                 return;
        }
        procs = newprocs;
        st = sysctl(mib, miblen, procs, &size, NULL, 0);
    }while (st == -1 && errno == ENOMEM);

    if (st != 0)
    {
        NSLog(@"Error: sysctl(KERN_PROC) failed.");
        return;
    }

    assert(size % sizeof(struct kinfo_proc) == 0);            // Do we match the kernel?
    nprocs = size / sizeof(struct kinfo_proc);
    if (!nprocs)
    {
        NSLog(@"Error: printProcessInfo.");
        return;
    }
    NSLog(@" PIDtNamen");
    NSLog(@"-----t--------------n");
    for (i = nprocs-1; i >=0; i--)
    {
                NSLog(@"%5dt%sn",(int)procs[i].kp_proc.p_pid, procs[i].kp_proc.p_comm);
    }
    free(procs);
}
Multitasking:
   Fast app switching
Multitasking:
   Fast app switching
   Push notifications
Multitasking:
   Fast app switching
   Push notifications
   Local notifications
Multitasking:
   Fast app switching
   Push notifications
   Local notifications
   Background audio
Multitasking:
   Fast app switching
   Push notifications
   Local notifications
   Background audio
   Voice over IP
Multitasking:
   Fast app switching
   Push notifications
   Local notifications
   Background audio
   Voice over IP
   Background location
Multitasking:
   Fast app switching
   Push notifications
   Local notifications
   Background audio
   Voice over IP
   Background location
   Task finishing
Multitasking:
   Fast app switching
   Push notifications
   Local notifications
   Background audio
   Voice over IP
   Background location
   Task finishing
Fast app switching
Push notifications
Key
!
K ey




!
K ey




!
!
Local notifications
UILocalNotification
*scheduledAlert
=
[[[UILocalNotification
alloc]
init]
autorelease];

scheduledAlert.applicationIconBadgeNumber=10;

scheduledAlert.fireDate
=
[NSDate
dateWithTimeIntervalSinceNow:10];

scheduledAlert.timeZone
=
[NSTimeZone
defaultTimeZone];

scheduledAlert.alertBody
=
@"Ваш
айПад
Самоуничтожится
через
5
секунд!";

[[UIApplication
sharedApplication]
scheduleLocalNotification:scheduledAlert];
UILocalNotification
*scheduledAlert
=
[[[UILocalNotification
alloc]
init]
autorelease];

scheduledAlert.applicationIconBadgeNumber=10;

scheduledAlert.fireDate
=
[NSDate
dateWithTimeIntervalSinceNow:10];

scheduledAlert.timeZone
=
[NSTimeZone
defaultTimeZone];

scheduledAlert.alertBody
=
@"Ваш
айПад
Самоуничтожится
через
5
секунд!";

[[UIApplication
sharedApplication]
scheduleLocalNotification:scheduledAlert];
Multitasking:
   Fast app switching
   Push notifications
   Local notifications
   Background audio
   Voice over IP
   Background location
   Task finishing
Background audio   Voice over IP    Background location




                       Info.plist
Background audio:
Background audio:
 NSData
*
data
=
[self
loadDataFile:@"/We
will
rok
you.mp3"];
 AVAudioPlayer
*
player
=
[[AVAudioPlayer
alloc]
initWithData:data
error:nil
];
 [player
play];
 AVAudioSession
*session
=
[AVAudioSession
sharedInstance];
 [session
setCategory:AVAudioSessionCategoryPlayback
error:nil];
 [session
setActive:YES
error:nil];
Background audio:
 NSData
*
data
=
[self
loadDataFile:@"/We
will
rok
you.mp3"];
 AVAudioPlayer
*
player
=
[[AVAudioPlayer
alloc]
initWithData:data
error:nil
];
 [player
play];
 AVAudioSession
*session
=
[AVAudioSession
sharedInstance];
 [session
setCategory:AVAudioSessionCategoryPlayback
error:nil];
 [session
setActive:YES
error:nil];
Background audio:
 NSData
*
data
=
[self
loadDataFile:@"/We
will
rok
you.mp3"];
 AVAudioPlayer
*
player
=
[[AVAudioPlayer
alloc]
initWithData:data
error:nil
];
 [player
play];
 AVAudioSession
*session
=
[AVAudioSession
sharedInstance];
 [session
setCategory:AVAudioSessionCategoryPlayback
error:nil];
 [session
setActive:YES
error:nil];



Background location:
Background audio:
 NSData
*
data
=
[self
loadDataFile:@"/We
will
rok
you.mp3"];
 AVAudioPlayer
*
player
=
[[AVAudioPlayer
alloc]
initWithData:data
error:nil
];
 [player
play];
 AVAudioSession
*session
=
[AVAudioSession
sharedInstance];
 [session
setCategory:AVAudioSessionCategoryPlayback
error:nil];
 [session
setActive:YES
error:nil];



Background location:
 CLLocationManager
*
locationManager
=
[[CLLocationManager
alloc]
init];
 locationManager.delegate
=
self;
 locationManager.desiredAccuracy
=
kCLLocationAccuracyBest;
 [locationManager
startUpdatingLocation];
Background audio:
  NSData
*
data
=
[self
loadDataFile:@"/We
will
rok
you.mp3"];
  AVAudioPlayer
*
player
=
[[AVAudioPlayer
alloc]
initWithData:data
error:nil
];
  [player
play];
  AVAudioSession
*session
=
[AVAudioSession
sharedInstance];
  [session
setCategory:AVAudioSessionCategoryPlayback
error:nil];
  [session
setActive:YES
error:nil];



Background location:
  CLLocationManager
*
locationManager
=
[[CLLocationManager
alloc]
init];
  locationManager.delegate
=
self;
  locationManager.desiredAccuracy
=
kCLLocationAccuracyBest;
  [locationManager
startUpdatingLocation];



Voice over IP:
  ???
Task finishing
Task finishing
  До 10 минут
Task finishing
                                           До 10 минут



UIBackgroundTaskIden0fier
identifer
=
[[UIApplication
sharedApplication]


            
            


            
            
          
          




beginBackgroundTaskWithExpirationHandler:^{
}];
Вопросы?
Спасибо!

[JAM 1.2] Design & Multitasking (Andrew Solovey)