Objective-C Memory Management Essentials
eBook - ePub

Objective-C Memory Management Essentials

Gibson Tang, Maxim Vasilkov

Condividi libro
  1. 200 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Objective-C Memory Management Essentials

Gibson Tang, Maxim Vasilkov

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

About This Book

  • Learn about the concepts of memory management in Objective-C
  • Get introduced to Swift, an innovative new programming language for Cocoa and Cocoa Touch
  • A step-by-step approach to various memory management techniques with lots of sample code and Xcode projects for your reference

Who This Book Is For

If you are new to Objective-C or a veteran in iOS application development, this is the book for you. This book will ensure that you can actively learn the methods and concepts in relation to memory management in a more engaging way. Basic knowledge of iOS development is required for this book.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Objective-C Memory Management Essentials è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Objective-C Memory Management Essentials di Gibson Tang, Maxim Vasilkov in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Programming. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2015
ISBN
9781849697132
Categoria
Programming

Objective-C Memory Management Essentials


Table of Contents

Objective-C Memory Management Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Introduction to Objective-C Memory Management
Why do we need memory management in Objective-C?
An object's ownership and life cycle
Ownership of object and reference counting
What's a memory leak and why pay attention to it?
What is an object within Objective-C?
Summary
2. Automatic Reference Counting
What is ARC and how does it work?
How ARC looks
Project settings for ARC
A memory model in Objective-C
What you need to know about ARC and weak references
Summary
3. Using Autorelease Pools
Understanding the autorelease pool mechanism
Autorelease pool mechanism
Reducing peak memory footprint with autorelease pool blocks
An overview of Apple autoreleased classes
NSRunLoop
NSException
ARC and autorelease
Autorelease pool blocks and threads
Summary
4. Object Creation and Storage
Creation and initialization of objects
What is a class?
Classes
Object immutability
Object mutability
Inheritance
Convenience initializers
An Objective-C programmer's responsibility
The singleton pattern
Creating @property
Creating custom methods
String formatting
Summary
5. Managing Your Application Data
Device memory
Image optimization
Lazy loading
Control creation
Caching
SDWebImage
Object serialization
SQLite
SQLite versus Core Data
Summary
6. Using Core Data for Persistence
Why use Core Data?
Understanding Core Data concepts
Putting it into practice
Getting into the code
Saving data into the persistent store
Deleting data from the persistent store
Updating data
Summary
7. Key-value Programming Approaches
What is key-value coding or KVC?
The NSKeyValueCoding protocol
Compliance of attributes and one-to-one relationships
Compliance of indexed one-to-many relationships
Compliance of unordered many-to-many relationships
Advantages of key-value coding
Disadvantages of key-value coding
Manual subsets of NSKeyValueCoding behavior
Advantages of creating your own lookup path
Disadvantages of creating your own lookup path
Associated objects
Advantages of using associated objects
Disadvantages of using associated objects
Selectors as keys
Advantages of using selectors as keys
Disadvantages of using selectors as keys
Maximum flexibility and handling unusual keys/values
Advantages of doing your own implementation
Disadvantages of doing your own implementation
Key-value observing
Implementing key-value observing
Performance considerations
Summary
8. Introduction to Swift
Welcome to Swift
Basics of Swift
Variable declaration
Iterating statements
Conditional statements
Functions
Classes and structures in Swift
Closures
Memory management in Swift
Summary
9. Memory Management and Debugging
Memory leaks
Strong/weak references
Retain cycles
Memory overuse
Using the debugger and breakpoints
Collecting data on your app
Plumbing memory leaks
Using the LLVM / Clang Static Analyzer
Using NSZombie
Summary
10. Tips and Tricks for Memory Management
Objective-C, C, and memory management
Getters and setters
The property attribute in Objective-C
Performance guidelines
Don't overthink about memory management
When to avoid KVC and KVO
Summary
11. Features of Xcode 6
Introducing Xcode 6
What's new in storyboard
Allowing storyboard or the NIB file to replace launch images
Launching images from your app
Universal storyboards
Debugging in Xcode 6
Debug gauges
What's new in Interface Builder
Playground for Swift
Summary
Index

Objective-C Memory Management Essentials

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: March 2015
Production reference: 1190315
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-84969-712-5
www.packtpub.com

Credits

Authors
Gibson Tang
Maxim Vasilkov
Reviewers
Emil Atanasov
Christine M. Gerpheide
Commissioning Editor
James Jones
Acquisition Editor
James Jones
Content Development Editor
Amey Varangaonkar
Technical Editor
Vijin Boricha
Copy Editor
Janbal Dharmaraj
Project Coordinator
Leena Purkait
Proofreaders
Simran Bhogal
Maria Gould
Indexer
Hemangini Bari
Graphics
Sheetal Aute
Production Coordinator
Melwyn D'sa
Cover Work
Melwyn D'sa

About the Authors

Gibson Tang grew up loving technology after getting his hands on an old Apple II when he was still a young kid. Since then, he has never stopped keeping pace with technology, and after he coded his first "Hello World" program, he has been hooked on programming ever since.
Following his studies at Nanyang Polytechnic and Singapore Institute of Management and serving a 6-year stint in the Republic of Singapore Navy (RSN), he honed his development skills creating software and games for Yahoo! and other Fortune 500 companies. In 2010, he founded Azukisoft Pte Ltd in Singapore to focus on mobile application development. Since then, he has developed countless mobile applications and games for start-ups and big companies both in USA and Singapore.
Apart from programming, he indulges in various hobbies such as soccer, computer games, and jogging in order to get his regular dose of Vitamin D and to see the sun once in a while. Occasionally, he would be on Steam or Battle.net blowing off some steam by slaying monsters and killer robots after a day of programming.

Indice dei contenuti