A Brief Guide To The iOS App Development

Page 1

A BRIEF GUIDE TO

THE iOS APP DEVELOPMENT


-------

.

Contents

Introduction

Chapter 1: iOS App Architecture ­­­­­ App Behaviors ­­­­­ The App Bundle ­­­­­­The App Life Cycle ­­­­­­The Structure Of An App ­­­­­­The Role Of Object In An iOS App

Chapter 2: Background Execution

­­­­­ Downloading Content In The Background ­­­­­ To Implement Long­Running Tasks ­­­­­­To Declare The App's Supported Background Tasks

Chapter 3: Strategies (For Handling App State Transitions) ­­­­­ The Launch Cycle

Chapter 4: Strategies (For Implementing Specific App Feature) ­­­­­­ How To Implement Specific Types Of Feature In Your App ­­­­­­ To Support Multiple Versions Of iOS ­­­­­­ Protecting Your Visual Appearance Of App Across Launches ­­­­­­ The Preservation & Restoration Process ­­­­­­ Tips For Developing & VoIP App

Chapter 5: Inter-App Communication ­­­­­­ To Support Air Drop

Chapter 6: Performance Tips

­­­­­­ Reducing The App's Power Consumption


Will This ebook Right For You? Maybe! See the content below in order to determine if your level matches the content that you are about to read. This ebook is not a beginner's guide to creating iOS apps, but this is for developers who want to polish their apps. With the help of this ebook, you'll get to know­ how the app interacts with the system & what it must do to make those interactions happen smoothly.

­­­­­­­­­­

.

Prefatory

The content is for those who are new to the subject. The introductory level of the topic is our ebook Understanding iOS App Development. It embraces step­by­step instructions on how to get started with iOS game programming.

­­­­­­­­­­­­­­­­­­­­­­­

.

Intermediate

Some intermediate content for those developers who are familiar with the subject but have the basic knowledge regarding the concept.

­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­

.

Advanced

Advanced sections for those who want to be an expert in the niche of iOS app development. After reading it, you'll feel ready not only to execute tactics & strategies. Nonetheless, teach everyone how to succeed in the niche.


­­­­­­­­­­­

.

INTRODUCTION

The marketing of iPhone app development is thriving! Thanks to the efforts of numerous creative companies & individual involved in iPhone app development. iPhone Apps are really hot! These are not the merely one of the biggest categories on the App store, but this is something that one of the best­selling categories among all. iPhone OS is a mobile operating system that is developed by Apple Inc. It was first released in the year of 2007, including iPhone & iPod. The iOS SDK has embraced from 1.0 to 9.0. iOS 9.x (iOS 9.0 Beta 1 & iOS 9.0 Beta 2) is the latest SDK and officially supported version in Xcode 7.0 Beta 1 & Beta 2. Having a wide range of Apple documentation & finding out which methods & libraries can be used by that is typically based on the deployment target. The Power of iOS embraces the following features, including Maps, Siri, Facebook & Twitter, Powerful APIs, Safari, etc. Numerous people use iPhone & iPad and it creates the opportunity for iPhone app developers that can create both free & paid applications in order to make money. For newbies to iOS, Apple has designed an “App Store” where the user can buy useful apps for their iOS devices.


1. iOS APP ARCHITECTURE The applications need to work with iOS in order to ensure that they deliver a great user­experience. Merely a good user­experience & a good applications' design, it offers a lot of other factors. Undoubtedly, people would love like to responsive, fast, simple & user­friendly applications from iOS apps. Also, apps need to support all the latest iOS devices. However, these tasks may seem daunting at first, this ebook helps you to make it happen very easily. This ebook highlights the core behaviours that make the app work amazingly well! If you are ready to take your ideas & turn them into an application then you need to completely understand the interaction between­ the system & your app.

Applications. Support Key Features The system believes that each app must have some specific resources & configuration data. For instance, an application icon & info regarding the applications' capabilities. Xcode renders some information regarding every new project. The main thing is that­ you must have resource files & make sure the info of the project of yours is correct before submitting the app! Follow Well­Defined Execution Paths During the life of an app, it can shift between foreground & background of execution. Plus, it can terminate & relaunch. Or, it can go to sleep for the time being. At every time, when it shifts to a new state, then the expectations change for the app. Foreground App: It can do almost anything. Background App: It can do as little as possible. Nevertheless, in order to change your app's behaviour, you use the state transitions. Must Run Expeditiously In A Multitasking Environment For users: the life of the battery is pivotal as in its performance, responsiveness & last but not the least great user experience. Regarding the app, it is pivotal to the minimal usage of battery that ensures the user that can run your app entire day without having recharge the device. The Communication Between Apps Must Follow­ The Specific Paths iOS Apps run in a sandbox as well as it has limited interaction between other apps. If you want to communicate with other apps on the system, then there are some specific ways. 'Performance Tuning' is Pivotal The task is performed by apps have a power cost associated with it. If the app drains the user's battery that create a negative user experience. Hence, be aware with the cost of diverse operations & take advantage of power­saving measures offered by the system.


App Behaviours Each new Xcode project comes designed to run right away in Simulator or on a device. Being able to run the app on the device, that does not mean that your app is ready to run on 'App Store'. Each & every app requires some magnitude of customization in order to ensure a great experience to the user. Does customization range from in order to provide an icon for your app to crafting architecture­level decision regarding­ How the application presents & uses the information? We are going to explain the behaviours that all apps are expected to handle & you should adapt these things at the early stage of the planning process.

The Required Set of Resources... Every application that you create has some set of resources & meta data. So that it can be displayed easily on iOS devices. The Information property­list file For your app, the Info.plist file contains metadata that the system uses to interact with your app. Xcode creates this file automatically that is based on your project's settings & configuration. If you want to modify the contents of that file directly, then you can do so from the information tab of your project. One or more icons The icon that displays the app icon on the home screen of the user's device. The system may use other versions of your icon in the Settings App when displaying the results of the search. One or more launch Images When an app launches, the system displays temporary images until the app is able to represent its user interface. And it provides the immediate feedback that the app is launching & it will be ready soon. The Declaration: Required capabilities of the app Each app must declare the hardware capabilities or features that are required to run. The app store uses the information in order to determine either a user can run your app on specific device or not.

The App Bundle When you build an iOS app, then Xcode packages it as a bundle. A bundle is a directory in the file system that groups related resources together in one place. iOS bundle contains the app executable files & supporting resource files that include app icons, image files & localized content.

The App Life Cycle Applications play a sophisticated interplay between the system framework & custom code. The System Framework­ it provides the basic infrastructure that the apps need to run. It also provides the


code that is required to customize the infrastructure. Finally, it provides the look & feel to the app that exactly you want to. The iOS Framework relies on the design patterns as in MVC (Mobile View Controller) & delegation in their implementation. In order to create the successful app, it is pivotal to understand­ the design patterns.

The Structure Of An App The functions UIApplicationMain handles the procedure by creating the core objects of the app and for start­up, this function sets up so many key objects. The heart of every iOS app is the UIApplication object that works to facilitate the interaction between the system & other objects in the app. The iOS apps use MVC (Model­view­controller) architecture. This kind of pattern separates the app's data & business logic from the visual presentation of the data. The architecture is pivotal in order to create an app that can run on 'diverse devices' with 'different screen sizes'. Figure­1

THE ROLE OF OBJECTS IN An iOS App UIApplication Object:

It manages the event loop & high­level app behaviors. Also, it reports key app transitions & some special events. Use the UIApplication object as is­that is, without subclassing.

App Delegate Object:

This is the heart of the custom­code. The object tasks with UIApplication object in order to handle app initialization, state transitions & many high­level app events. App Delegate object uses to set up


the application's initial data structures.

Documents & Data Model Objects: The Data Model Objects store the content of the app. Apps can also be used documents objects in order to manage few or all data model objects. The documents objects are not needed but offering the convenient method to group data, which belongs to the single file or file package.

View Controller Objects:

It manages the presentation of the content of your app. A view controller manages a single view & the collection of sub­views. For all view controller objects, the UIViewController class is the base class. Providing default functionality for loading views, presenting & rotating them in response to device rotations.

UIWindow Object:

It coordinates the presentation of one or more views on screen. Usually, most apps have only one window that represents content on the main screen. But, apps may have an additional window for content that is displayed on an external display.

View, Control & Layer Objects

Views & controls render the visual presentation of app's content. A view is an object that draws the content in a designed rectangular area. The Control objects are specialized type of view responsible to events within the area. The UIKit Framework provides standard views for presenting numerous different types of content.


2. BACKGROUND EXECUTION If the user isn't actively using your app, then the system moves it to the background state. For numerous apps, the background is merely a brief stop to the app that is being suspended. Do you know that suspended apps are the way in order to improve the battery life that allows the system to devote pivotal system resources to the new foreground apps that have drawn the user's attention? There are a number of apps that can move to the extended state so easily, but there are some legal reasons for apps to continue running in the background. The techniques offered by iOS fall into three categories: • • •

Apps that needs to run in the background in order to specific types of tasks that can declare their support for one or more execution roles. Apps that start a short task in the foreground that can ask for time to finish the task­ when the apps move to the background. Apps which initiate downloads in the foreground. Thereby, allowing the apps to be suspended or terminated whilst the download continues.

Downloading Content In The Background In order to download the file, the apps should be an NSURLSession object to start the downloads. So that the system can take complete control of the download process when the app is suspended. The process for creating a configuration object which supports the background downloads as follows: •

Create the configuration object using the backgroundsessionconfigurationwithidentifier method of NSURLSessionConfiguration.

Set the value for configuration object

Configure any other properties of the configuration objects

Use the Configuration object to create NSURLSession object

To Implement Long-Running Tasks Tasks require more execution time to implement, then you must request specific permissions to run them in the background. In iOS, there are some specific apps that are allowed to run in the background: Applications­ – – – – – –

That play audible content to the user whilst in the background. For instance, music player app. That record audio content whilst in the background. That keep users informed at all times. For instance, Navigation app That support voice over internet Protocol (VoIP) That require to download & process the new content regularly That receive regular updates from external accessories


To

Declare

The

App's

Supported

Background

Tasks In Xcode5, you do declare the background modes that your app supports from the capabilities tab of project settings. Here are the background modes for apps: • • • • • • • • •

Audio & Airplay Location Updates Voice Over IP Newsstand Download External accessory Communication Background Fetch Remote Notifications Uses Bluetooth LE Accessories Acts as a Bluetooth LE Accessories

To Track The User's Locations Numerous ways to track the user's locations in the background that do not actually require your app to run continuously in the background: • • •

Background Location Services Foreground­only Location Services The Significant change Location Service

To Play & Record Background Audio You must be familiar with the app that plays & records the background audio continuously that can register to perform these tasks in the background. You can enable audio support from the Background modes section of the capabilities tab in your Xcode project. The apps that play audio content in the background that must play audible content & not silence. Here are the typical examples of background audio apps: • • • •

Music Player App Audio Recording App App that supports audio as well as video playback over AirPlay VoIP Apps

In the case, when UIBackgroundModes key contains the audio value, then the media frameworks automatically prevent the corresponding app from being suspended when we talk about the background. As long as it plays audio or video content, then the app continuously contains in the background, and the process for using the frameworks is unchanged.

To Implement A VoIP App Allowing the user to make phone calls using an internet connection rather than the cellular service of the device. But an app needs to maintain a persistent network connection to its associated service so that it can receive incoming calls & other relevant data. In order to configure a VoIP app, then you must do the following: •

Enable support for VoIPfrom the background modes section of the capabilities tab in Xcode project.


• • •

For VoIP usage, configure of the app's sockets. Call the setKeepAliveTimeout: handler method to install a handler to be executed periodically. Configure audio session to handle transitions to & from active use.

To Fetch Small Amounts Of Content Opportunistically The Application that needs to check for new content periodically that can ask the system to wake up early that they can fetch operation for the content. In order to support the mode, you have to enable Background fetch option from the Background fetch option of the “Capabilities Tab” in your Xcode project. You can enable this support by this method also, including UIBackgroundModes key with the fetched value in the app's Info.plist file. In order to enable this mode is not guaranteed that the system will give the app to perform background fetches anytime. When the favourable opportunities arise, the system wakes up or launches the app into the background & call the app delegate's application: performFetchWithCompletionHandler: method. Use this method in order to check for the new content and initiate the download operation if the content is available.

To Use Push­Notifications To Initiate The Download In case, if the server sends the push­notifications to the user's device when new content is available for your app, then you can ask the system to run the app in the background. In order to support this Background mode: •

Enable the Remote Notification Options from the Background modes section of the Capabilities tab in the Xcode project.

Alternative Method: You can also enable the support, including the UIBackgroundModes key with the remote­notification value in the app's Info.plist file.

For a push notification to activate the download operation, the notification's payload must embrace content­available key with its value set to 1. While downloading any content, it is recommended that use the NSURLSession class to initiate. Hence, manage your downloads.

To Download Newsstand Content In The Background •

The Newsstand App downloads new magazine or newspaper issues that can register in order to perform these downloads in the background.

To enable this support by including the UIBackgroundModes key with the newsstand­ content value in the app's Info.plist file.

To Communicate With An External Accessory

To enable this support by including the UIBackgroundModes key with the external­accessory value in the app's Info.plist file.

To Communicate With The Bluetooth Accessory To enable this support by including the UIBackgroundModes key with the Bluetooth­central value in the app's Info.plist file.


To Understand When, The App Gets Launched Into The Background The App, which supports the background execution may be relaunched by the system in order to handle the upcoming events. In case, when the app is terminated for any reason other than the user force quitting it. The system launches the app when there are one of the following events happen: • • • •

For Location Apps For Bluetooth Apps For Audio Apps For Background Download Apps

How To Opt Out Of Background Execution If you do not want to run your app in the background at all, then you can do it by adding the UIApplicationExitsOnSuspend key to your app's Info.plist file.


3.

STRATEGIES

(FOR

HANDLING

APP

STATE TRANSITIONS) For every run­time state of an app, the system has myriad expectations during the app is in the state. When it comes to “State Transitions”, then the system notifies the app object that in turn notifies the app delegate. Use state transition methods of the UIApplicationDelegate protocol in order to detect these state changes & respond accordingly.

The Launch Cycle When the app launches, it moves from “the not running state” to “active or background” state. The system creates the process & main thread of your app. Plus, it calls your app's main function on the main thread. The default main function comes from Xcode project over the UIKit Framework that does not most of the work in initializing your app & preparing it to run. Figure:1 Launching An App Into The Foreground


Figure­2 Launching An App Into The Background


4. STRATEGIES (FOR IMPLEMENTING SPECIFIC APP FEATURES) Diverse apps have different requirements, but there is one thing that is common among all apps that are “behavior”.

How To Implement Specific Types Of Features In Your AppPrivacy Strategies To protect the user's privacy is quite an important task more than anything in order to design an app. The privacy protection includes protecting the user's data, personal info & user's identity. The system frameworks provide privacy controls for managing data e.g. contacts. But your app should take steps in order to protect the data that you use locally.

To Protect Data Using On­Disk Encryption The data protection uses built­in hardware in order to store files in an encrypted format on­disk and to decrypt them on demand. As long as user's device is locked, the protected files are unapproachable. The user must unlock the device by entering the appropriate passcode before an app can access one of protected files. Data protection is available on iOS devices & it is subjected to the following requirements: • •

The file system (user's device) must support data protection. The user must have an active passcode lock set for the device.

Protecting The File: To Protect a file, add this attribute either NSData class or NSFileManager class. To Write New Files: Writing new files, use writeToFile:options:error: method of NSData with an appropriate protection value. For Existing File: Use the setAttributes:ofItemAtPath:error: method of NSFileManager to set or change the value of NSFileProtection key.

To Identify the Unique Users of Your App It is pivotal that you should identify the unique users of your app. iOS providers identifiers can help you to do that. In case, if need a higher level of securities, then you might need to do more work on your own. For instance, an app that provides financial services that would likely to ready the user for login credentials in order to ensure that the user is authorized to access a specific amount. Note: Identifying the user, always be transparent regarding what you think to do with any kind of information that you obtain. Moreover, it is not acceptable to identify the users so you can stalk them surreptitiously. Have a look to the following scenarios that may need you to identify the user, along with the solutions for How to implement them?


Linking A User To The Specific Amount On Your Server: It includes a login screen, which requires the user to enter their account information securely. Bear in mind that always protect the user's information by storing it an encrypted form.

Differentiating The Instances Of Your App Running On Diverse Devices: Use the identifierForVendor property of the UIDevice class to obtain an ID that differentiate the user on one device from users to other. The technique does not allow you to identify specific users. A single user can have myriad devices with a different id value.

Identifying The User For The Purposes Of Advertising:

Use the advertisingIdentifier property of the ASIdentifierManager class to obtain an ID for the user. Due to the reason is that­ users are allowed to run apps on all their iOS devices. Apple does not render a way to identify the same user on myriad devices.

To Support Multiple Versions of iOS The App, which supports the latest versions of iOS plus one or earlier versions must use runtime checks in order to prevent the use of newer APIs that is an older version of iOS. The Runtime Checks­ It prevents your app from crashing when it tries to use a feature which is not available on the recent operating system.

Protecting Your Visual Appearance of App across launches It does not matter if the app supports background execution, and it can not run forever! At that point, the system might need to terminate your app in order to free up the memory for the current foreground app. Moreover, the user should never be interested if an app is already running or was terminated. Quitting an app should just seem like a temporarily interruption. When, for example, you are a user, you return to the app, the app should always return the user to the last point of use. So that, if you come back to the app, then the app should always return to the last point, where you left the task. And this kind of behavior renders a better experience for the user & with the restoration support that is built into UIKit that is relatively easier to achieve. The State Prevention System­ In UIKit provides the state prevention system provides a simple but flexible infrastructure for preserving & restoring the state of the app's views & view controllers. Well, there are three places where you should think about state prevention in your apps: • • •

The delegate object of the app that manages the app's top­level state. The view controller objects of the app that manage the overall state for the user interface of app. The custom views of app that might have some customized data that needs to be preserved.

UIKit allows you to opt for which parts of the user interface that you want to preserve. In case, if you already have custom code in order to handle state preservation. You can use that code & migrate parts to the UIKit state preservation system as needed.

To Enable State Preservation & Restoration In Your App


The two­ State Preservation & Restoration both are not automatic features. Apps indicate their support for the feature in order to implement the following methods in their app delegate: application: shouldSaveApplicationState: application: shouldRestoreApplicationState:

The Preservation & Restoration Process Both processes are opt­in features & work with the help of your app. You app does identify the objects that should be preserved & UIKit does the work preserving & restoring these objects at appropriate times. Due to the reason that­ UIKit handles so much of the process. It also helps to understand what it does behind the scenes so that you know how the customized code fits the overall scheme. UIKit preserves your app's state at appropriate times, in case when your app moves from the foreground to the background. Whilst the restoration process, UIKit uses the preserved data to reconstitute the interface but the creation of actual objects is handled by the code. Due to your app may load the objects from a storyboard file automatically, only when the code knows which object need to be created. Whilst Preservation, The App Is Responsible For: • • •

To tell the UIKit that it supports state preservation To tell the UIKit that view controllers & views should be preserved To encode the relevant data for any preserved objects

Whilst Restoration, The App Is Responsible For: • To tell the UIKit that it supports state restoration • To provide the objects that are requested by UIKit • To decode the state of your preserved objects & using it to return the object to its previous state

Tips for Developing a VoIP App VoIP is Voice Over Internet Protocol that allows the user to make a call over internet connection instead of the cellular services. This app needs to maintain persistent network connection to its connected service so that it can receive incoming calls & other relevant data. Instead of keep VoIP apps awake all the time, then the system allows them to be suspended & providing facilities in order to monitor their sockets. In case, if incoming traffic is detected, then the system wakes up the VoIP app and returns control of its sockets to it. For implementing the VoIP app, there are numerous requirements out there: • • • • • •

Enable the voice over IP background mode for your app. For VoIP usage, configure one of the app's sockets. Before moving to the background, call the setKeepAliveTimeout:handler: method in order to install a handler to be executed periodically. Configure your audio session to handle transitions to & from active use. Ensuring a better user experience on iPhone, use the Core Telephony Framework to adjust your behavior in relation to cell­based phone calls. Ensuring good performance for your VoIP app, use the System Configuration Framework to detect the network changes & allow your app to sleep as much as possible.


5.Inter-App Communication Apps can communicate indirectly with other apps on the device! You can use AirDrop to share files & data with other apps. In addition, you can also define custom URL scheme. So that the apps can send information to your with the help of URLs.

To Support AirDrop With the help of AirDrop, you can share images, documents & another sort of data with nearby devices. On the other hand, AirDrop takes advantage of peer­to­peer (P2P) networking to find out close devices & connect to them.

To Send Data & Other Documents To Another App Using AirDrop, you can send data & other documents, use UIActivityViewController object to display an activity sheet from your user interface. You can specify images, strings, URLs & other types of data as well as you can also pass custom objects that adopt the UIActivityItemSource protocol.

To Receive Files & Data Sent To Your App In order to receive files & data sent to your app using AirDrop, you can do the following: • • •

In Xcode, declare support for the document types that your app is capable of opening. Implement the application: OpenURL:sourceApplication:annotation: method. Use this method to receive the data, which was sent by another app. And be prepared to look for files in your app's Documents/Index directory & move them out of that directory as needed.

To Use URL Schemes To Communicate With Apps The next is URL schemes, it lets you communicate with apps through a protocol that you specify. In order to communicate with an app which implements such a scheme that you must create an fittingly formatted URL and ask the system to open it.

To Send A URL To Another App If you want to send data to an app that implements a custom URL scheme. Create an appropriately formatted URL & call the OpenURL: method of the app object. The OpenURL: method launches the app with registered scheme & passes the URL to it. At the point, control passes to the new app.

To Implement Custom URL Schemes If the app can receive specially formatted URLs, then you should register the corresponding URL schemes with the system. Apps use customized URL schemes to vend services to other apps. For instance, the Maps App supports URLs for displaying map locations.

To Register Custom URL Scheme


Include the CFBundleURLTypes key in your app's Info.plist file. The CFBundleURLTypes key contains an array of dictionaries & each of that defines a URL scheme the app support. CFBundleURLName­ A string contains the abstract name of the URL scheme. Ensuring uniqueness & it is recommended that you specify a reverse DNY­style of identifier. For instance com.acme.myscheme. CFBundleURLSchemes­ An array of string containing the URL scheme names. For instance HTTP, mailto, tel, & SMS.

To Handle URL Requests The app which have its own custom URL scheme must be able to handle URLs passed to it. All URLs passed to the app delegate (either at launch time or app is running or in the background). Handling incoming URLs, the delegate should implement the following: •

Use the application:willFinishLaunchingWithOptions: and application:didFinishLaunchingWithOptions: methods to retrieve the information about the URL

Use the application:openURL:sourceApplication:annotation: method to open file.


6. Performance Tips Every step during the development of app, consider the implementation of the design choices on the entire performance of the app. There are two extremely pivotal considerations for iOS apps i.e. 1. Power Usage 2. Memory Consumption In addition, there are several considerations apart from the above two.

Reducing The App's Power Consumption “Power consumption” is always an issue. The power management system in iOS preserves power by shutting down any hardware features that are not recently being used. You can easily improve battery life in order to optimize the use of the following features: • • • • •

The Disk The CPU The Core Location Framework Bluetooth, Wi­fi, & the Baseband (EDGE, 3G) radios The Accelerometers

The objective of optimizations should be to the most work that you can in the best effective & possible way. You must always optimize the algorithm of your apps using instruments. However, even the most optimized algorithm can still have a negative impact on the battery life of device. Thus, you should follow these guidelines whilst writing your code: •

Always avoid doing work that requires “polling”. The term “polling” prevents the CPU from going to sleep. Rather than polling, use the NSRunLoop or NSTimer classes to schedule work as needed.

Don't draw to the screen faster than is needed. Whilst drawing is costly operation when it comes to power. And also don't rely on hardware in order to throttle the frame rates.

If you use UIAccelerometer class to receive regular accelerometer events.

Also, avoid accessing the disk too frequently.

It is pivotal that­ the more data you transmit to the network, the more power must be used to run the radios. However, to access the network, this is the most pivotal power­intensive operation that you can perform. You can also minimize the timings by following these guidelines: •

Connect to the external network servers only when needed and do not poll those servers.

When you connect to the network, then the smallest amount of data needed to the job. You can avoid that to use the compact data formats. Do not include excess content that is simply ignored.

Connect to the network to the using the WiFi radios whenever possible. WiFi generally uses less power. This is proffered over cellular radios.

If you use Core Location framework in order to gather information, disable location updates as soon as you can. Set the distance filter & accuracy levels to suitable values.


The instrument apps include many instruments in order to gather power related information. You can use these instruments in order to gather general information regarding­ power consumption as well as gather specific measurements for hardware including WiFi & Bluetooth Radios, Display, GPS Receiver & CPU.

Use Memory Expeditiously Usually, the apps are encouraged in order to usage as little as possible, therefore, system may keep more apps in memory & dedicate more memory to foreground apps. The amount of free memory available to the system is directly proportional to the relative performance of your app. If there the free memory is less that means the system the system is more likely to have trouble fulfilling memory requests. Ensuring that there is always enough memory available, that you should minimize your app's memory usage & to be responsive when the system asks you to free space in memory.

Tips for Efficient Networking One of the most­power intensive options­ to implement code to receive or transmit data across the network. In order to minimize the amount of time spent transmitting or receiving data that helps to improve your battery life. When writing the network­related code, you should consider the following tips: • •

Avoid using “chatty protocols”. For protocols, define your data formats to be as compact as possible.

To Use WiFi Using the WiFi radios, you must notify the systems, including UIRequiresPersistentWiFi key in the app's Info.plist file.

Improving the File Management Generally, file operations are relatively slow & involve writing to the flash drive that has a limited lifespan. Avoid writing cache files to the disk. When your app is quit & you need to write state information that can be used to put the app back into the same state when it is next launched.


Build Awesome iOS Apps Start Creating Your Own iOS App


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.