• Complain

Robert Clair [Robert Clair] - Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition

Here you can read online Robert Clair [Robert Clair] - Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2012, publisher: Addison-Wesley Professional, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Robert Clair [Robert Clair] Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition
  • Book:
    Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition
  • Author:
  • Publisher:
    Addison-Wesley Professional
  • Genre:
  • Year:
    2012
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Get Started Fast with Objective-C 2.0Programming for OS X Mountain Lion, iOS 5.1, and Beyond

Fully updated for Xcode 4.4, LearningObjective-C 2.0, Second Edition, is todays mostuseful beginners guide to Objective-C 2.0. One step at atime, it will help you master the newest version of Objective-C 2.0and start writing high-quality programs for OS X 10.8 MountainLion, iOS 5.1, and all of Apples newest computers anddevices.

Top OS X and iOS developer Robert Clairfirst reviews the essential object and C concepts that everyObjective-C 2.0 developer needs to know. Next, he introduces thebasics of the Objective-C 2.0 language itself, walking through codeexamples one line at a time and explaining whats happeningbehind the scenes.

This revised edition thoroughly introducesApples new Automated Reference Counting (ARC), while alsoteaching conventional memory-management techniques that remainindispensable. Carefully building on what youve alreadylearned, Clair progresses to increasingly sophisticated techniquesin areas ranging from frameworks to security. Every topic has beencarefully chosen for its value in real-world, day-to-dayprogramming, and many topics are supported by hands-on practiceexercises.

Coverage includes

Reviewing key C techniques and concepts, from program structure andformats to variables and scope

Understanding how objects and classes are applied in Objective-C2.0

Writingyour first Objective-C program with Xcode 4.4

Usingmessaging to efficiently perform tasks with objects

Gettingstarted with Apples powerful frameworks and foundationclasses

UsingObjective-C control structures, including Fast Enumeration andexception handling

Addingmethods to classes without subclassing

Usingdeclared properties to save time and simplify your code

Mastering ARC and conventional memory management, and knowing whento use each

UsingBlocks to prepare for concurrency with Apples Grand CentralDispatch

Leveraging Xcode 4.4 improvements to enums and @implementation

Robert Clair [Robert Clair]: author's other books


Who wrote Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition? Find out the surname, the name of the author of the book and a list of all author's works by series.

Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
A. Reserved Words and Compiler Directives

Table A.1. C Reserved Words

Beginning with Mac OS X Snow Leopard version 106 Apple adds the keyword - photo 1

Beginning with Mac OS X Snow Leopard (version 10.6), Apple adds the keyword __block to C.

Table A.2. Additional Objective-C Reserved Words

The following words are used as type qualifiers in the Objective-C remote - photo 2

The following words are used as type qualifiers in the Objective-C remote messaging system. Remote messaging is not covered in this book.

Table A.3. Remote Messaging Reserved Words

Table A4 Objective-C Compiler Directives B Toll-Free Bridged Classes - photo 3

Table A.4. Objective-C Compiler Directives

B Toll-Free Bridged Classes Table B1 Core Foundation Types That Are - photo 4
B. Toll-Free Bridged Classes

Table B.1. Core Foundation Types That Are Toll-Free Bridged to Foundation Classes

Note These are currently the only toll-free bridged classes You should not - photo 5

Note

These are (currently) the only toll-free bridged classes. You should not use type or class names as a guide. If a class and type are not in the preceding table, they are not toll-free bridged, even if the class and type names are the same or similar.


See https://developer.apple.com/library/ios/#documentation/CoreFoundation/Conceptual/CFDesignConcepts/Articles/tollFreeBridgedTypes.html#//apple_ref/doc/uid/TP40010677-SW1.

C. 32- and 64-Bit

At the time of the first edition of this book, Apple was in the process of moving OS X to 64-bit. That transition is now almost complete. Xcode and Clang build OS X programs as 64-bit by default. With Lion (OS X 10.7) new Macs boot a 64-bit kernel by default. While it is still possible to build 32-bit Objective-C programs for OS X, 32-bit OS X programs use the legacy runtime and cannot use the newer features of the Objective-C language such as ARC, synthesized instance variables, and instance variables that are declared in class extensions.

iOS and iOS devices are 32-bit only. The material in the rest of this appendix refers to OS X.


Note

The earliest Intel Macs (those with Core Duo or Core Solo processors) are 32-bit only.


The terms 32-bit and 64-bit refer to the number of bits used to address memory. A 32-bit program uses pointers that are 4 bytes wide and can address 232 or about 4 gigabytes (GB) of memory. A 64-bit program can theoretically address 264, or about 1.8 1019, bytes of memory. In practice, current Intel machines use only 48 of the 64 bits in an 8-byte pointer for addressing, giving a maximum address of about 280 terabytes. (A terabyte is about 1012 bytes.)

What is the point of such huge numbers? As computers have become faster, people in some disciplines have begun to write programs to work with very large data sets, large enough to run into the 4 GB limit on 32-bit addresses. On the hardware side, physical memory above 4 GB has become much more common. (Apple now sells laptops with up to 8 GB of physical memory and desktops with up to 32 GB of physical memory.) There is clear pressure to expand the size of addressable memory beyond 4 GB. Computer architectures work best with sizes that are powers of two, so the next logical pointer size after 4 bytes is 8 bytes.


Note

When thinking about this subject, remember that Mac OS X has a swap system and that each process has its own virtual address space. A process does not need to be loaded completely into physical memory in order to execute; the swap system takes care of moving memory pages between physical memory and the swap area on disk. A process that uses 2 GB of memory will run on a machine that has 1 GB of physical memory, albeit potentially much more slowly than it would run on a machine with 4 GB of physical memory (assuming that the 4 GB machine isnt running other large programs at the same time).


Kernel and User Programs in 64-Bit

The kernel and user programs are separate. Each can be either 32- or 64-bit. A 32-bit kernel can run both 32- and 64-bit user programs. So can a 64-bit kernel.

Programs must be entirely 64-bit or entirely 32-bit. If you compile a program for 64-bit, all the libraries and frameworks that you link against, and any plugins your program uses, must be available in 64-bit versions. This is not a problem for the system-supplied libraries and frameworks, such as the Cocoa frameworks, which are all available in 64-bit versions. However, if you are using other libraries, you may have to compile them yourself for 64-bit (if you have access to the source) or continue to build your program as a 32-bit application until 64-bit versions of the resources become available.

Coding Differences for 64-Bit Programs

The main difference between 32- and 64-bit executables is the size of some of the primitive types. In a 32-bit executable, ints, longs, and pointers are all 4 bytes. In a 64-bit executable, ints are still 4 bytes, but longs and pointers are 8 bytes. The primary point, the one that can cause you trouble, is that in a 64-bit executable, longs and pointers are no longer the same size as ints.

Assigning a type to a longer type is OK, but assigning a longer type to a shorter type truncates the value held in the longer type and may result in nonsense. This may seem an obvious point, but there is a long history in C programming of ignoring the difference between a pointer and an int, and ignoring the fact that many system calls actually return long rather than int. Glossing over the difference between a pointer and an int, or the difference between a long and an int, makes no real difference when they are all 4 bytes; but the same code compiled for 64-bit can cause real problems. When coding for 64-bit, you should be careful when doing pointer arithmetic; you should never cast a pointer to an int variable.

Performance

Does compiling a program as a 64-bit executable make it run faster? There is no way to tell without building the program as separate 32- and 64-bit executables and then comparing the execution times. When you move to a 64-bit executable, there are some competing effects. On one hand, when an Intel CPU runs in x86_64 (64-bit) mode, it has access to more registers. It can use these registers instead of the stack to pass arguments during a function call, resulting in better performance. But moving from a 32- to a 64-bit executable can cause your programs memory footprint to increase (because many 4-byte variables are now 8-byte variables), sometimes dramatically. The larger size can mean more instruction cache misses, which results in worse performance.

Compiling for 32-Bit and 64-Bit

New OS X projects in the current version of Xcode default to 64-bit. If you use the Clang compiler on the command line, it also defaults to 64-bit.

If you want to compile a program as 32-bit (if, for example, you are maintaining a program that must still run on older, 32-bit-only Macs), you can tell Clang to produce a 32-bit executable by using the -arch

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition»

Look at similar books to Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition»

Discussion, reviews of the book Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers, Second Edition and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.