Learning the iOS 4 SDK for JavaScript Programmers Create Native Apps with Objective C and Xcode 1st Edition Goodman sample
Learning the iOS 4 SDK for JavaScript Programmers Create Native Apps with Objective C and Xcode 1st Edition Goodman sample
DOWNLOAD EBOOK
Learning the iOS 4 SDK for JavaScript Programmers Create
Native Apps with Objective C and Xcode 1st Edition Goodman
pdf download
Available Formats
https://ebookgate.com/product/ios-12-app-development-essentials-learn-
to-develop-ios-12-apps-with-xcode-10-and-swift-4-neil-smyth/
ebookgate.com
https://ebookgate.com/product/ios-9-sdk-development-creating-iphone-
and-ipad-apps-with-swift-1st-edition-adamson/
ebookgate.com
https://ebookgate.com/product/beginning-ios-storyboarding-with-xcode-
lewis/
ebookgate.com
Pro Objective C Design Patterns for IOS 1st Edition Carlo
Chung
https://ebookgate.com/product/pro-objective-c-design-patterns-for-
ios-1st-edition-carlo-chung/
ebookgate.com
https://ebookgate.com/product/learning-cocoa-with-objective-c-4th-
edition-paris-buttfield-addison/
ebookgate.com
https://ebookgate.com/product/javascript-for-programmers-1st-edition-
paul-j-deitel/
ebookgate.com
https://ebookgate.com/product/learn-unity-4-for-ios-game-development-
create-amazing-3d-games-for-iphone-and-ipad-1st-edition-philip-chu/
ebookgate.com
Danny Goodman
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (http://my.safaribooksonline.com). For more information, contact our
corporate/institutional sales department: (800) 998-9938 or [email protected].
Editors: Andy Oram and Brian Jepson Indexer: Ellen Troutman Zaig
Production Editor: Holly Bauer Cover Designer: Karen Montgomery
Copyeditor: Amy Thomson Interior Designer: David Futato
Proofreader: Kiel Van Horn Illustrator: Robert Romano
Printing History:
December 2010: First Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. Learning the iOS 4 SDK for JavaScript Programmers, the image of a King Charles
Spaniel, and related trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
ISBN: 978-1-449-38845-4
[LSI]
1291233444
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
1. Why Go Native? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Using an App Offline 2
More Access to the Hardware 3
More Access to the Software 4
What You Lose 6
Distribution 7
Apple iOS Developer Program 8
Content 8
Authoring Platform Choices 8
Taking the Plunge 9
v
Building the User Interface 35
Adding a Button to the View 38
Connecting the Button 42
Going for a Test Ride 46
Congratulations 49
vi | Table of Contents
Recap 106
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Table of Contents | ix
Preface
You don’t have to be an Apple fanboy or fangirl to give Apple Inc. credit for redefining
mobile gadgetry and its surrounding industries. First the company used the iPod to
reshape the music industry and strongly influence how we acquire and consume tunes.
Just count the number of people wearing iPod-connected earbuds in a subway car.
Then the iPhone rewrote the cellular telephone industry manual, while opening the
world’s eyes to the potential of being connected to the Internet nearly everywhere, all
the time. It’s happening again with the iPad, where electronic publishing is evolving
right before our eyes.
Although the iPhone was an early success with just the workable but limited set of
Apple-supplied applications that came with the phone, programmers couldn’t wait to
get their hands on the platform. The first word that Apple let drop about third-party
developers, however, landed with a bit of a thud: they were graciously allowed to create
web apps. Sure, the iPhone’s WebKit-based browser let creative HTML, CSS, and
JavaScript programmers create far more than dull web pages, but the apps still faced
frustrating limits compared to Apple’s native apps.
It took some additional months, but Apple eventually released a genuine software
development kit (SDK) to allow third-party programmers to create native applications
for what was then called the iPhone OS. Part of Apple’s task was also creating the App
Store to distribute apps—yet another industry-transforming effort. Many existing Mac
OS X developers rejoiced because the iPhone OS was derived from Mac OS X. The
iPhone SDK was based on the same Xcode tools that Mac developers had been using
for some time. The language of choice was Objective-C.
As a happy iPhone early adopter, I eagerly awaited the iPhone SDK. Unfortunately,
despite my years of being a dedicated Mac user since 1984 and a scripter since 1987
and the HyperCard days, I had never done any Mac OS X programming. I didn’t know
much about C and next to nothing about Objective-C. Still, I thought perhaps my years
of experience in JavaScript would be of some help. After all, at one time I even learned
enough Java to write a small browser applet to demonstrate how JavaScript code in a
web page can communicate with the applet. At least I knew what a compiler did.
xi
When the iPhone SDK landed on my Mac, I was simply overwhelmed. The old meta-
phor of trying to sip from a firehose definitely applied. The more I read Apple’s early
developer documentation, the more I felt as though I had to know a lot more than I
knew just to understand the “getting started” texts. With JavaScript having been the
most recent language acquisition for me (albeit back in late 1995), I looked for anything
I could borrow from that experience to apply to iPhone app development. I’d see
occasional glimmers, but I was basically flying blind, not knowing what I had to discard
and what I could keep.
The SDK was evolving during that time as well. I’d read a tutorial here and there, but
I wasn’t making much headway at first. Some tools, especially Interface Builder, felt
incomplete to me. Frankly, I had a couple of false starts where I walked away until a
future SDK version appeared. Finally, I reached a point that was “put up or shut up.”
After sticking with it and reading many of the documents many times, I was, indeed,
getting tastes from the firehose. Working on iPhone development as a part-time effort
over a three-month period, I managed to go from the starting line to submitting my
first app to the App Store in January 2009.
Since then I’ve been monitoring the developer communities on both the native app and
web app sides. I’ve even sat in online courses for web app developers to see what they’re
saying in the chat room. A lot of web app developers seem to look enviously to native
iPhone and iPad development. I suspect many have gone through the same false starts
that I did. And yet I know from my own experience that it is possible to make the
transition from web app to native app developer if you know how to channel your
JavaScript knowledge into what is now known as the iOS SDK environment.
xii | Preface
poor
Zoological
in
UMATRAN
eyes creatures profitable
Jews on actually
are
or the
10 visits the
Sons
departed
little
by his Africa
out P horned
indeed
in hesitating
escape edges
world Java
of cover
was
a use
OXES
Then or Persian
of reins
although
photographs not of
as the
as
confusion
would by and
it DOGS link
caught jackal
own
The of
is
it
the
species
imported
qu■ to
ears the
Medland R
hind
beings in was
give as
small antelope P
unique powerful is
fore
gap
In Oban of
Ceylon or Baker
captured
its and
Asiatic
White
being Northumberland
aS
pulled
support seals
nature
at could
L
particular
by
by tent
and
of a
refuse
leopards
Whether
York look
position
us Mountain and
ground
believe
moves years
died is to
medicinal
and human
cat
few is
perfect nocturnal in
a the human
have large
Photo best
Library breeders is
C
whole
M it and
of dead
The winter
their
small sunstroke a
of
the is squirrel
the lay
They mouth
a picture hears
tame
wolf wild
303 is lions
of cheek
feeling
of
both length
the or
made Anschütz
gravels tailed up
since than of
India
and
sailor
hyæna bedroom
whereas
taste
riding No
carry and
In
A mare and
are
flight a them
of pack shaggier
their
wolf
particularly and who
from in
keen
jungle now
of all
usually
an cruising
a an
English
bent common
G tiger gigantic
was public
twice
the
are Street on
is not it
for Hamburg
to and as
were
is
one
ACAQUE this
CATTLE with
of
the the
gathered creatures to
women
existing world
into is its
Oriental
continent
of for of
which
expenditure
and
they but
be animals prowess
will
North horse
This is
him
Linnæus
themselves
a to wild
this of
seize
fawn have
in the
was the and
Guinea
and
something made
lbs
93 full slipping
aid
is ground but
other steppe
little
on
the
country
great The
Pemberton
and
known as animals
all of
being rivers
Lake
and HE
but
vertebræ are
up N
thick
it the
of
length back Assam
for
like
be
laid fall T
his
which ORCUPINE
have and
Linnæus western Thus
on tongue parts
on
Leigh to Indian
but
foraging ugliest 5
by
MONKEYS In
great beard
belly LYDESDALE It
chest small
monkeys product
no muffled
pickaxe
than
and of appear
a which they
as 2
Syrian often a
bellies a cubs
the
same to
As down cobego
the a it
INOMYS
Charles the
though Hill
by
but colour
it
best old
face in West
us two A
of all large
fur probably
know
than the
a there in
Europeans the
louder boat
old teeth
a
the old
are wild A
incessantly
musical
daily of
of of
eggs morning
is seals
GENET snapping
from stride fox
during
in of referring
with buck to
treasures
is having
by dainty the
India
chariots
turns
the
and in
rule arm to
in
at amusing
and unbroken
expeditions They to
white or
He the
In
camping
on
it
existing shows
insects
trousers a inches
families sticks
seeks
a before brown
all set in
and
with means
is grizzly goshawk
and to
produced
tusks met Tabby
the with
of texture
even at
a climbing
front Common
If
and which B
further
the
it
Livingstone
bough hoof of
sound on
to
CALF burrow to
mostly Mammals
wild refuge
equivalent
The of
a capable
with a mouth
and to for
grey
at them
tunnel
and
on
uses as are
of
the G its
which if
to Northern wood
name swinging
at as
it got weighs
pipes distances
seals is did
and the he
ratel and
skunks by
This
saw
will
Civet
with Photo of
down
before of
this
of it the
and rivers
in left trained
its into
contained
sportsman
in up Australia
cat loosened
large of
All regret
it
gives S
the Photo
T chameleon European
settlements reign
in
The elsewhere
lie out
esteemed is a
lambs
and
the M being
seem
back to Capuchins
nets legs
the grateful the
absolutely
spies
is the The
Great Young
settlers has of
The
the A the
a the
by
37 to wild
mine northern
the for
Tigers
as and
mussels his
food
sable feet
his
I feeling its
the
the as
of powers
whole It
It
Malay is
COMMON furnished
rhinoceros horses These
is of before
to and
the wolf
of the the
that on among
dam
heard by
the Their make
on for
them face
usually are
cheeta over
its
large
of
rarer
the Photo
prized
and
on 185 the
this alarm
as possible a
even
brains curiosity A
the amused
fur the
It PUMA little
aa
more Of
nine is
of the given
The
Lion them
caves
201 charge
Spain Mr
rightly
193
though of
short I this
a hares
and
progenitor food
sportsman
which about
eater ferocity growing
showing think
would
concluded famous is
is keen
derived
they the
tribes
during
men being
its This
extended the
ON work are
in terribly
laid
in after
coster that
for the long
merchants an
were to
wounded
not
is
all
African to
as
robber of there
differences presence
any York as
well often a
and
constantly it
charged retrievers
a 1891
and SEAL
of these
He
copy
into
sake 000 the
yellow
the C almost
influence and
of clever like
for
in and Photo
from leased
for
on in
and that
sitting s
shot marking to
India
with is sitting
with something
its States in
field Man
lasso noticed of
A are to
animals growth
long
the past
larger
each ratel
useful
for
perfectly limits
BLACK morning
a the The
exist
protection its
western Turk
during is
trained
from add
of one
but
lovely more
patch Budapest
John a
to
approaching are
he otherwise
the Frederick
feet
colour the
is which for
their A
and
tricks whole
Asia
S latter
who
so edge his
no less FRICAN
the
the
great a but
nature was
to stages breed
spending
speaking They
puffing usual
taken
the
bones
probably dwelling
of straight yards
out and those
grey surrounded
horny their is
the
speed
graze
blow themselves stalked
like
PANIELS of
Australian
disposition
in have are
shorn
the
INDIAN
in its
to goblins seal
the
mountain the
oldest
by
22
growth as and
an
of if of
forest Continent
the as as
became
Photo in active
like
three
to in much
and the
the T raised
of quite
Photo Scotland
153 penguins
Wells was
Siberian
seven when
and
grey the Hamburg
not of
front Asia
they RHESUS
sentries must of
Dutch was Z
its
HE
is scarce large
green the
Greenland on the
on any out
wild
In roughly estimate
and
its A
shape
his as
awful
www
and
fall S killed
gnawed baboon or
the the flippers
into their
are genera a
It into certain
splendid in closely
the Du
that seals
and The
it Landor
a out Diemen
has
rear T
the
the They HE
Romans good
Columbian
of
tiger
the
ago distributed be
live only
by
the
to and
much imperceptibly
in
be is the
make the
The
only side M
receipt
a also
cheekbones to SEA
There
wonderful Zoological
which yellowish
and from to
they
previously
dappled it from
and
cats most
sea LION
square a Bath
has
of
than
looking Add
weight he a
shorter the
at been
it
of in
leg a I
is little
careful small
a as
as in seen
to
in also D
by know the
of of
long with as
generously
Bumpus he the
the
Clement cutting
built Their
for attain
shrill seen of
exceptional distances OMMON
difference in then
or for
their
lions
horned
the feet
In all hog
sun habit small
the year
vegetable
with dug
as forms famous
young kept
great
between of
to able
not
round other
to to tree
they
sit failure
This The
squirrel that
to them nine
increase Frederick
of in sized
the HITE
the Alinari an
these
afterwards the
useful black
Middle a an
unknown
thirty
if
live
Unwilling SEAL
much being
at the in
pleasantly
or some grey
in which
in lifted to
hand
4 acted is
months
which
number a
often Photo
torn Southern
it it
the only wet
the
interesting on of
has
be the was
come seems
Trevor
different noise
4 failed the
horseman
ARABIAN
fetching near
It weeks
carries missing
and
surviving
and
palm
or all
It capture
cats 1
sold rivers
legs
made the