SlideShare a Scribd company logo
iOS Training
(Advanced)
Gurpreet Singh
Sriram Viswanathan

Yahoo! Confidential

1
Topics
 Using custom delegate and protocols
 Saving and Restoring the Application State

 Introduction to NSURLConnection
 Hands on example for
 Fetching data from server
 Using Table View Controller
 Populating Data in a Table
 Refreshing Data

 Deploying your app on a device

Yahoo! Confidential

2
Using custom delegate and protocols
Defining Protocol
@protocol DataConsumerDelegate
// Method to handle response of the rest connection call
- (void) finishedReceivingData: (NSData *) data;
@end

Conforming to protocol
@interface MyDataConsumer : NSObject <DataConsumerDelegate>
@end
@implementation MyDataConsumer
- (void) finishedReceivingData: (NSData *) data {
// HANDLE THE DATA
}
@end

Yahoo! Confidential

3
Using custom delegate and protocols
Using delegate
@interface AsynchronousRestConnection : NSObject {
id<DataConsumerDelegate> dataConsumerDelegate;
}
// Used to store delgate object (it must conform to DataConsumerDelegateprotocol)
@property (nonatomic, weak) id<DataConsumerDelegate> dataConsumerDelegate;
- (void) getData;

@end
@implementation AsynchronousRestConnection
@synthesize dataConsumerDelegate;
- (void) getData {
// GET DATA AND STORE IT IN data
// YOU CAN DO MULTI QUERY AND MERGE OUTPUT
[self.dataConsumerDelegate finishedReceivingData:data];
}
@end

Yahoo! Confidential

4
Using custom delegate and protocols
Updating the MyDataConsumer class to use AsynchronousRestConnection
@interface MyDataConsumer : NSObject <DataConsumerDelegate>
- (void) getDataFromApi;
@end
@implementation MyDataConsumer
- (void) finishedReceivingData: (NSData *) data {
// HANDLE THE DATA
}
- (void) getDataFromApi {
AsynchronousRestConnection *arc = [[AsynchronousRestConnection alloc] init];
arc.dataConsumerDelegate = self;
// CONSUME DATA

}
@end

Yahoo! Confidential

5
Topics
 Using custom delegate and protocols
 Saving and Restoring the Application State

 Introduction to NSURLConnection
 Hands on example for
 Fetching data from server
 Using Table View Controller
 Populating Data in a Table
 Refreshing Data

 Deploying your app on a device

Yahoo! Confidential

6
Saving and Restoring Application State
During the preservation and restoration process, your app has a handful of
responsibilities.

During preservation, your app is responsible for:
 Telling UIKit that it supports state preservation.
 Telling UIKit which view controllers and views should be preserved.
 Encoding relevant data for any preserved objects.
During restoration, your app is responsible for:
 Telling UIKit that it supports state restoration.
 Providing (or creating) the objects that are requested by UIKit.
 Decoding the state of your preserved objects and using it to return the
object to its previous state.

Yahoo! Confidential

7
Saving and Restoring Application State
High-level flow interface preservation

Yahoo! Confidential

8
Saving and Restoring Application State
High-level flow for restoring your user interface

Yahoo! Confidential

9
Topics
 Using custom delegate and protocols
 Saving and Restoring the Application State

 Introduction to NSURLConnection
 Hands on example for
 Fetching data from server
 Using Table View Controller
 Populating Data in a Table
 Refreshing Data

 Deploying your app on a device

Yahoo! Confidential

10
Introduction to NSURLConnection
 Asynchronous Request
 Synchronous Request

 POST request
 Using Connection Timeout
 Cache Policies

Yahoo! Confidential

11
Asynchronous Request
To fetch some data, we’ll follow these 3 basic steps:
 Have our class conform to the NSURLConnectionDelegate protocol and
declare a var to store the response data
 Implement the NSURLConnectionDelegate protocol methods
 Create an instance of NSURLRequest and NSURLConnection to kick off
the request

Yahoo! Confidential

12
Asynchronous Request
Step 1:

Yahoo! Confidential

13
Asynchronous Request
Step 2:

Yahoo! Confidential

14
Asynchronous Request
Step 3:

Yahoo! Confidential

15
Asynchronous Request
Step 4:
 First connection:didReceiveResponse will be hit, indicating that the server
has responded.
 Then the handler, connection:didReceiveData: will be hit several times.
 This is where you’ll append the latest data to the response data variable
you declared in Step 1.
 Then finally, connectionDidFinishLoading: will be hit and you can parse
the response data variable.

Yahoo! Confidential

16
POST Request
A synchronous request looks like the below:

 You’ll set the HTTPMethod property to POST

 You’ll assign the header fields and value in the body
 Ensure that you’re using an instance of NSMutableURLRequest because
NSURLRequest is immutable.
Yahoo! Confidential

17
Using Connection Timeout
Using Connection Timeout



If you want to set a timeout for your data retrieval, you can set the timeoutInterval
property of your NSURLRequest.



Ensure that you’re using an instance of NSMutableURLRequest because
NSURLRequest is immutable.

Yahoo! Confidential

18
Cache Policies
To specify how your data should be cached locally, you can set a cache
policy with your NSURLRequest.
Following snippet shows you how you can define a cache policy and a
timeout.

 If you don’t specify any caching policy with your NSURLRequest, then it
will try to conform to whatever the protocol states.
 For example, with HTTP it will look at the server response headers and try
to conform to what it dictates about caching.

Yahoo! Confidential

19
Topics
 Using custom delegate and protocols
 Saving and Restoring the Application State

 Introduction to NSURLConnection
 Hands on example for
 Fetching data from server
 Using Table View Controller
 Populating Data in a Table
 Refreshing Data

 Deploying your app on a device

Yahoo! Confidential

20
Topics
 Using custom delegate and protocols
 Saving and Restoring the Application State

 Introduction to NSURLConnection
 Hands on example for
 Fetching data from server
 Using Table View Controller
 Populating Data in a Table
 Refreshing Data

 Deploying your app on a device

Yahoo! Confidential

21
Deploying your app on a device
Steps to deploy your app on a device
Step 1: iOS Developer Program (iPhone provision portal)
Step 2: Create a Certificate Signing Request
Step 3: Create a Development Certificate
Step 4: Adding a Device
Step 5: Create an App ID
Step 6: Create a Provisioning Profile
Step 7: Configuring the Project
Step 8: Build and Run
For detail refer:
http://mobile.tutsplus.com/tutorials/iphone/how-to-test-your-apps-on-physical-iosdevices/
Yahoo! Confidential

22

More Related Content

What's hot

PyCon DE 2013 - Table Partitioning with Django
PyCon DE 2013 - Table Partitioning with DjangoPyCon DE 2013 - Table Partitioning with Django
PyCon DE 2013 - Table Partitioning with Django
Max Tepkeev
 
ABPerformance Quick Tour
ABPerformance Quick TourABPerformance Quick Tour
ABPerformance Quick Tour
Active Base
 
secure data transfer and deletion from counting bloom filter in cloud computing.
secure data transfer and deletion from counting bloom filter in cloud computing.secure data transfer and deletion from counting bloom filter in cloud computing.
secure data transfer and deletion from counting bloom filter in cloud computing.
Venkat Projects
 
Towards Secure and Dependable Storage Services in Cloud Computing
Towards Secure and Dependable Storage Services in Cloud  Computing Towards Secure and Dependable Storage Services in Cloud  Computing
Towards Secure and Dependable Storage Services in Cloud Computing
IJMER
 
Attribute based storage supporting
Attribute based storage supporting Attribute based storage supporting
Attribute based storage supporting
CloudTechnologies
 
M-Tech Project Attribute-Based Storage Supporting Secure Deduplication of Enc...
M-Tech Project Attribute-Based Storage Supporting Secure Deduplication of Enc...M-Tech Project Attribute-Based Storage Supporting Secure Deduplication of Enc...
M-Tech Project Attribute-Based Storage Supporting Secure Deduplication of Enc...
CloudTechnologies
 
Towards secure and dependable storage service in cloud
Towards secure and dependable storage service in cloudTowards secure and dependable storage service in cloud
Towards secure and dependable storage service in cloud
sibidlegend
 
4 trigger
4  trigger4  trigger
4 trigger
Trần Thanh
 
Tair
TairTair
Tair
lynnwong
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
Umar Farooq
 
Towards secure and dependable storage
Towards secure and dependable storageTowards secure and dependable storage
Towards secure and dependable storage
Khaja Moiz Uddin
 
datastore_devfest2020_incheon
datastore_devfest2020_incheondatastore_devfest2020_incheon
datastore_devfest2020_incheon
Toru Wonyoung Choi
 
Parameter substitution in Aginity Workbench
Parameter substitution in Aginity WorkbenchParameter substitution in Aginity Workbench
Parameter substitution in Aginity Workbench
Mary Uguet
 
Oracle performance tuning
Oracle performance tuningOracle performance tuning
Oracle performance tuning
vksgarg
 
Panda public auditing for shared data with efficient user revocation in the c...
Panda public auditing for shared data with efficient user revocation in the c...Panda public auditing for shared data with efficient user revocation in the c...
Panda public auditing for shared data with efficient user revocation in the c...
IGEEKS TECHNOLOGIES
 

What's hot (15)

PyCon DE 2013 - Table Partitioning with Django
PyCon DE 2013 - Table Partitioning with DjangoPyCon DE 2013 - Table Partitioning with Django
PyCon DE 2013 - Table Partitioning with Django
 
ABPerformance Quick Tour
ABPerformance Quick TourABPerformance Quick Tour
ABPerformance Quick Tour
 
secure data transfer and deletion from counting bloom filter in cloud computing.
secure data transfer and deletion from counting bloom filter in cloud computing.secure data transfer and deletion from counting bloom filter in cloud computing.
secure data transfer and deletion from counting bloom filter in cloud computing.
 
Towards Secure and Dependable Storage Services in Cloud Computing
Towards Secure and Dependable Storage Services in Cloud  Computing Towards Secure and Dependable Storage Services in Cloud  Computing
Towards Secure and Dependable Storage Services in Cloud Computing
 
Attribute based storage supporting
Attribute based storage supporting Attribute based storage supporting
Attribute based storage supporting
 
M-Tech Project Attribute-Based Storage Supporting Secure Deduplication of Enc...
M-Tech Project Attribute-Based Storage Supporting Secure Deduplication of Enc...M-Tech Project Attribute-Based Storage Supporting Secure Deduplication of Enc...
M-Tech Project Attribute-Based Storage Supporting Secure Deduplication of Enc...
 
Towards secure and dependable storage service in cloud
Towards secure and dependable storage service in cloudTowards secure and dependable storage service in cloud
Towards secure and dependable storage service in cloud
 
4 trigger
4  trigger4  trigger
4 trigger
 
Tair
TairTair
Tair
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
 
Towards secure and dependable storage
Towards secure and dependable storageTowards secure and dependable storage
Towards secure and dependable storage
 
datastore_devfest2020_incheon
datastore_devfest2020_incheondatastore_devfest2020_incheon
datastore_devfest2020_incheon
 
Parameter substitution in Aginity Workbench
Parameter substitution in Aginity WorkbenchParameter substitution in Aginity Workbench
Parameter substitution in Aginity Workbench
 
Oracle performance tuning
Oracle performance tuningOracle performance tuning
Oracle performance tuning
 
Panda public auditing for shared data with efficient user revocation in the c...
Panda public auditing for shared data with efficient user revocation in the c...Panda public auditing for shared data with efficient user revocation in the c...
Panda public auditing for shared data with efficient user revocation in the c...
 

Viewers also liked

OctHighlander
OctHighlanderOctHighlander
OctHighlander
David Lee
 
JanuaryFebruary Highlander
JanuaryFebruary HighlanderJanuaryFebruary Highlander
JanuaryFebruary Highlander
David Lee
 
Pro301 o week 2 assignment
Pro301 o week 2 assignmentPro301 o week 2 assignment
Pro301 o week 2 assignment
michaellobianco1
 
iOS training (intermediate)
iOS training (intermediate)iOS training (intermediate)
iOS training (intermediate)
Gurpreet Singh Sachdeva
 
Pro301 Week 5 Assignment
Pro301 Week 5 AssignmentPro301 Week 5 Assignment
Pro301 Week 5 Assignment
michaellobianco1
 
iOS App performance - Things to take care
iOS App performance - Things to take careiOS App performance - Things to take care
iOS App performance - Things to take care
Gurpreet Singh Sachdeva
 
Firefox addons
Firefox addonsFirefox addons
Firefox addons
Gurpreet Singh Sachdeva
 

Viewers also liked (7)

OctHighlander
OctHighlanderOctHighlander
OctHighlander
 
JanuaryFebruary Highlander
JanuaryFebruary HighlanderJanuaryFebruary Highlander
JanuaryFebruary Highlander
 
Pro301 o week 2 assignment
Pro301 o week 2 assignmentPro301 o week 2 assignment
Pro301 o week 2 assignment
 
iOS training (intermediate)
iOS training (intermediate)iOS training (intermediate)
iOS training (intermediate)
 
Pro301 Week 5 Assignment
Pro301 Week 5 AssignmentPro301 Week 5 Assignment
Pro301 Week 5 Assignment
 
iOS App performance - Things to take care
iOS App performance - Things to take careiOS App performance - Things to take care
iOS App performance - Things to take care
 
Firefox addons
Firefox addonsFirefox addons
Firefox addons
 

Similar to iOS training (advanced)

High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2
Mario Redón Luz
 
Dataguard presentation
Dataguard presentationDataguard presentation
Dataguard presentation
Vimlendu Kumar
 
Asp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptxAsp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptx
sridharu1981
 
Oracle Data Guard for Beginners
Oracle Data Guard for BeginnersOracle Data Guard for Beginners
Oracle Data Guard for Beginners
Pini Dibask
 
IOUG Collaborate 18 - Data Guard for Beginners
IOUG Collaborate 18 - Data Guard for BeginnersIOUG Collaborate 18 - Data Guard for Beginners
IOUG Collaborate 18 - Data Guard for Beginners
Pini Dibask
 
ASP.NET Session 11 12
ASP.NET Session 11 12ASP.NET Session 11 12
ASP.NET Session 11 12
Sisir Ghosh
 
less08.ppt
less08.pptless08.ppt
Oracle Data Guard
Oracle Data GuardOracle Data Guard
Oracle Data Guard
Martin Meyer
 
Oracle data guard for beginners
Oracle data guard for beginnersOracle data guard for beginners
Oracle data guard for beginners
Pini Dibask
 
Using InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in JmeterUsing InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in Jmeter
Knoldus Inc.
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
Vivek chan
 
Data Guard25 August
Data Guard25 AugustData Guard25 August
Data Guard25 August
Guenadi JILEVSKI
 
Automated Testing with Databases
Automated Testing with DatabasesAutomated Testing with Databases
Automated Testing with Databases
elliando dias
 
Introduction to GraphQL Presentation.pptx
Introduction to GraphQL Presentation.pptxIntroduction to GraphQL Presentation.pptx
Introduction to GraphQL Presentation.pptx
Knoldus Inc.
 
Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4
than sare
 
File Repository on GAE
File Repository on GAEFile Repository on GAE
File Repository on GAE
lynneblue
 
Merging and Migrating: Data Portability from the Trenches
Merging and Migrating: Data Portability from the TrenchesMerging and Migrating: Data Portability from the Trenches
Merging and Migrating: Data Portability from the Trenches
Atlassian
 
AfNetworking vs. Native + Caching
AfNetworking vs. Native + CachingAfNetworking vs. Native + Caching
AfNetworking vs. Native + Caching
KLabCyscorpions-TechBlog
 
Save data locally
Save data locallySave data locally
Save data locally
Anjan Debnath
 
Ado.net
Ado.netAdo.net
Ado.net
Iblesoft
 

Similar to iOS training (advanced) (20)

High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2High Availability And Oracle Data Guard 11g R2
High Availability And Oracle Data Guard 11g R2
 
Dataguard presentation
Dataguard presentationDataguard presentation
Dataguard presentation
 
Asp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptxAsp .Net Database Connectivity Presentation.pptx
Asp .Net Database Connectivity Presentation.pptx
 
Oracle Data Guard for Beginners
Oracle Data Guard for BeginnersOracle Data Guard for Beginners
Oracle Data Guard for Beginners
 
IOUG Collaborate 18 - Data Guard for Beginners
IOUG Collaborate 18 - Data Guard for BeginnersIOUG Collaborate 18 - Data Guard for Beginners
IOUG Collaborate 18 - Data Guard for Beginners
 
ASP.NET Session 11 12
ASP.NET Session 11 12ASP.NET Session 11 12
ASP.NET Session 11 12
 
less08.ppt
less08.pptless08.ppt
less08.ppt
 
Oracle Data Guard
Oracle Data GuardOracle Data Guard
Oracle Data Guard
 
Oracle data guard for beginners
Oracle data guard for beginnersOracle data guard for beginners
Oracle data guard for beginners
 
Using InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in JmeterUsing InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in Jmeter
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
 
Data Guard25 August
Data Guard25 AugustData Guard25 August
Data Guard25 August
 
Automated Testing with Databases
Automated Testing with DatabasesAutomated Testing with Databases
Automated Testing with Databases
 
Introduction to GraphQL Presentation.pptx
Introduction to GraphQL Presentation.pptxIntroduction to GraphQL Presentation.pptx
Introduction to GraphQL Presentation.pptx
 
Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4Spring review_for Semester II of Year 4
Spring review_for Semester II of Year 4
 
File Repository on GAE
File Repository on GAEFile Repository on GAE
File Repository on GAE
 
Merging and Migrating: Data Portability from the Trenches
Merging and Migrating: Data Portability from the TrenchesMerging and Migrating: Data Portability from the Trenches
Merging and Migrating: Data Portability from the Trenches
 
AfNetworking vs. Native + Caching
AfNetworking vs. Native + CachingAfNetworking vs. Native + Caching
AfNetworking vs. Native + Caching
 
Save data locally
Save data locallySave data locally
Save data locally
 
Ado.net
Ado.netAdo.net
Ado.net
 

Recently uploaded

BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
sayalidalavi006
 

Recently uploaded (20)

BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
 

iOS training (advanced)

  • 1. iOS Training (Advanced) Gurpreet Singh Sriram Viswanathan Yahoo! Confidential 1
  • 2. Topics  Using custom delegate and protocols  Saving and Restoring the Application State  Introduction to NSURLConnection  Hands on example for  Fetching data from server  Using Table View Controller  Populating Data in a Table  Refreshing Data  Deploying your app on a device Yahoo! Confidential 2
  • 3. Using custom delegate and protocols Defining Protocol @protocol DataConsumerDelegate // Method to handle response of the rest connection call - (void) finishedReceivingData: (NSData *) data; @end Conforming to protocol @interface MyDataConsumer : NSObject <DataConsumerDelegate> @end @implementation MyDataConsumer - (void) finishedReceivingData: (NSData *) data { // HANDLE THE DATA } @end Yahoo! Confidential 3
  • 4. Using custom delegate and protocols Using delegate @interface AsynchronousRestConnection : NSObject { id<DataConsumerDelegate> dataConsumerDelegate; } // Used to store delgate object (it must conform to DataConsumerDelegateprotocol) @property (nonatomic, weak) id<DataConsumerDelegate> dataConsumerDelegate; - (void) getData; @end @implementation AsynchronousRestConnection @synthesize dataConsumerDelegate; - (void) getData { // GET DATA AND STORE IT IN data // YOU CAN DO MULTI QUERY AND MERGE OUTPUT [self.dataConsumerDelegate finishedReceivingData:data]; } @end Yahoo! Confidential 4
  • 5. Using custom delegate and protocols Updating the MyDataConsumer class to use AsynchronousRestConnection @interface MyDataConsumer : NSObject <DataConsumerDelegate> - (void) getDataFromApi; @end @implementation MyDataConsumer - (void) finishedReceivingData: (NSData *) data { // HANDLE THE DATA } - (void) getDataFromApi { AsynchronousRestConnection *arc = [[AsynchronousRestConnection alloc] init]; arc.dataConsumerDelegate = self; // CONSUME DATA } @end Yahoo! Confidential 5
  • 6. Topics  Using custom delegate and protocols  Saving and Restoring the Application State  Introduction to NSURLConnection  Hands on example for  Fetching data from server  Using Table View Controller  Populating Data in a Table  Refreshing Data  Deploying your app on a device Yahoo! Confidential 6
  • 7. Saving and Restoring Application State During the preservation and restoration process, your app has a handful of responsibilities. During preservation, your app is responsible for:  Telling UIKit that it supports state preservation.  Telling UIKit which view controllers and views should be preserved.  Encoding relevant data for any preserved objects. During restoration, your app is responsible for:  Telling UIKit that it supports state restoration.  Providing (or creating) the objects that are requested by UIKit.  Decoding the state of your preserved objects and using it to return the object to its previous state. Yahoo! Confidential 7
  • 8. Saving and Restoring Application State High-level flow interface preservation Yahoo! Confidential 8
  • 9. Saving and Restoring Application State High-level flow for restoring your user interface Yahoo! Confidential 9
  • 10. Topics  Using custom delegate and protocols  Saving and Restoring the Application State  Introduction to NSURLConnection  Hands on example for  Fetching data from server  Using Table View Controller  Populating Data in a Table  Refreshing Data  Deploying your app on a device Yahoo! Confidential 10
  • 11. Introduction to NSURLConnection  Asynchronous Request  Synchronous Request  POST request  Using Connection Timeout  Cache Policies Yahoo! Confidential 11
  • 12. Asynchronous Request To fetch some data, we’ll follow these 3 basic steps:  Have our class conform to the NSURLConnectionDelegate protocol and declare a var to store the response data  Implement the NSURLConnectionDelegate protocol methods  Create an instance of NSURLRequest and NSURLConnection to kick off the request Yahoo! Confidential 12
  • 16. Asynchronous Request Step 4:  First connection:didReceiveResponse will be hit, indicating that the server has responded.  Then the handler, connection:didReceiveData: will be hit several times.  This is where you’ll append the latest data to the response data variable you declared in Step 1.  Then finally, connectionDidFinishLoading: will be hit and you can parse the response data variable. Yahoo! Confidential 16
  • 17. POST Request A synchronous request looks like the below:  You’ll set the HTTPMethod property to POST  You’ll assign the header fields and value in the body  Ensure that you’re using an instance of NSMutableURLRequest because NSURLRequest is immutable. Yahoo! Confidential 17
  • 18. Using Connection Timeout Using Connection Timeout  If you want to set a timeout for your data retrieval, you can set the timeoutInterval property of your NSURLRequest.  Ensure that you’re using an instance of NSMutableURLRequest because NSURLRequest is immutable. Yahoo! Confidential 18
  • 19. Cache Policies To specify how your data should be cached locally, you can set a cache policy with your NSURLRequest. Following snippet shows you how you can define a cache policy and a timeout.  If you don’t specify any caching policy with your NSURLRequest, then it will try to conform to whatever the protocol states.  For example, with HTTP it will look at the server response headers and try to conform to what it dictates about caching. Yahoo! Confidential 19
  • 20. Topics  Using custom delegate and protocols  Saving and Restoring the Application State  Introduction to NSURLConnection  Hands on example for  Fetching data from server  Using Table View Controller  Populating Data in a Table  Refreshing Data  Deploying your app on a device Yahoo! Confidential 20
  • 21. Topics  Using custom delegate and protocols  Saving and Restoring the Application State  Introduction to NSURLConnection  Hands on example for  Fetching data from server  Using Table View Controller  Populating Data in a Table  Refreshing Data  Deploying your app on a device Yahoo! Confidential 21
  • 22. Deploying your app on a device Steps to deploy your app on a device Step 1: iOS Developer Program (iPhone provision portal) Step 2: Create a Certificate Signing Request Step 3: Create a Development Certificate Step 4: Adding a Device Step 5: Create an App ID Step 6: Create a Provisioning Profile Step 7: Configuring the Project Step 8: Build and Run For detail refer: http://mobile.tutsplus.com/tutorials/iphone/how-to-test-your-apps-on-physical-iosdevices/ Yahoo! Confidential 22

Editor's Notes

  1. Another Reference:http://www.raywenderlich.com/8003/how-to-submit-your-app-to-apple-from-no-account-to-app-store-part-1