Tip:
Highlight text to annotate it
X
so when the user hits the i'd come for your application for the first time it's
going to start up
and in that first launch is gonna be calling methods in the end delegate like
application did finish launching with options
an interview control elective you did load
as part of that start a process
but you can't count
on these two methods alone because when the user hits the home button your
application's going to disappear but it doesn't completely terminated doesn't
except all the way
and that means
the next time the user test the item to open the apt
it'll look the same to them but they will not
be hitting those the same events
and this is because all u_s_ devices by default use multi tasking
but what apple mean by multitasking may not be what you mean by multitasking
it certainly does not mean that your ad just runs all the time after someone has
pressed the homebound that would be a far few uncontrolled state of affairs
for apple to allow
so your apt
would disappear from the screen
an entire
a background state a suspended state not an actively running one
if the user tax your application icon to run it again
moves from that background state to the foreground state again they can also
double-click the home button
to get the list of applications that are in the background and relaunch it that
way in the cycle continues
so we don't just have life-cycle events for launching the happen terminating the
apt
but also for moving to the background of moving to the foreground
and these methods include
application will resign active application did enter background the ab
disappears we launch it again we get amputation will enter for grand
application did become active
but of course the cycle can continue
had the home button will resign again will end to the background
and whether it's
amend it later or how weak later
application went a forgone the application will become active
disconnect in time and time again
these will be called automatically when that process happens and they're going
to be the key methods to respond to if you need to do anything when the user
moves in and out of your house
as they could be called dozens of times between the first
application did finish launching adoptions
and the final
application will terminate which really gets called but can be if you have is
indeed a fully executed
because you have
can still be required to accept all the way out
either because i i west commands it
the operating system on the device can decide it needs the memory
or the user can also exit your application
by double clicking the home button to see the list of apts and holding them
down and tapping the minus button an invalid exit process
i was will call
application will terminate in europe delegate
but do you notice when you're looking at the boiler plate provided out delegate
call that these are very well commented application will resign active
application due to enter background will enter foreground
did become active
an application will terminate
and whether you're truly terminating or just moving to a background state you
always have to be quick about what you're going to do an any of these
methods
because you only have a few seconds to exit before iris decide you're taking
too long
and just kills your process
but if you don't read transition into the background
or what is your application doing in the background
but by default
absolutely
nothing
i'll show you how it is taking up a little bit of memory
but no processing cycles
so if you had started a long-running calculation or long-running
network operation those are not just continuing in the background
your camp is not
napa tenure ap do something in the background
well maybe there is a very short uncontrolled list of want an i_r_s_ that
has allowed to do once it's moved about background state
and you have to asked permission of i_r_s_ by making a change to one of your
absence supporting vows to do any of these
the five very specific things and i can do
play audio so you can move to the background and continue to
play audio from a network stream or from the ipod library
you cannot react to you
location changes perhaps for creating a navigation dampened prompts you can keep
a voice-over i_p_ connection alive to make calls of your internet connection
if you're right and you stand happy you can download content what happens in the
background
and if you're connected to an accessory europe can talk to that
you can also ask permission to perform some small generic background passed but
you do not get free reign on the processor
now all of these are specialized options outside the scope of this class we will
be working with background operations here but if you did have something in
mind that needed to do these
they are available what we'll be working with at the waist to react not just a
complication lawns and terminate events but also to our have moving between
background and foreground states