SlideShare ist ein Scribd-Unternehmen logo
1 von 20
iOS Training
Day 4
JSON Web Services
● Javascript Object Notation
● The JSON data format is widely used across the
modern web and it is one of the most common
ways to transfer data.
● Many modern APIs, RESTful web services in
particular, support the JSON data format.
● JSON is a commonly used data format that is
used for communication between, for example,
clients and servers.
● It is popular because of it's usability across
virtually any mobile platform such as iOS,
Android, Windows Phone, and web browsers.
● The code snippet on the right side is an
example of the JSON data format.
{
"dataTitle": "JSON Tutorial!",
"swiftVersion": 2.1
"users": [
{
"name": "John",
"age": 25
},
{
"name": "Mark",
"age": 29
},
{
"name": "Sarah",
"age": 22
}
],
}
JSON Web Services - Contd.
As you can see in the code snippet, the JSON data format is easy to understand. JSON is structured using two
collection types, dictionaries and arrays. Dictionaries contains one or more of key-value pairs and are enclosed by
curly braces, {}. Arrays contain a list of ordered items and are enclosed by square brackets, []. Almost every
programming language defines these collection types, which is why JSON is supported by nearly every every
language around.
The following is a list of the supported data types in a JSON object:
● String
● Number (integer, float, double, etc.)
● Boolean
● Array
● Dictionary
Part of the reason why JSON is so popular is because it is easy to read by humans and it can also be easily parsed
and serialized by machines. Parsing and serializing is when the machine takes in raw data and turns that into an
object useable by the application.
JSON Web Services - Sample
func getIPAddress()
{
let session = URLSession.shared
let urlPath = URL(string: "https://api.ipify.org/?format=json" )
var request = URLRequest(url: urlPath! as URL)
request.httpMethod = "GET"
let task = session.dataTask(with: request, completionHandler: {(data, response, error) in
if(error == nil)
{
do
{
let JSON = try JSONSerialization.jsonObject(with: data!, options:JSONSerialization.ReadingOptions.allowFragments)
print("IPAddress response is (JSON)")
let ipAddressDict = JSON as! [String: Any]
let ipAddress: String = ipAddressDict["ip"] as! String
print(ipAddress)
}
JSON Web Services - Sample
catch let JSONError as NSError
{
print("IPAddress API Error - (JSONError)")
}
}
else
{
print("IPAddress API Error - (error!)")
}
})
task.resume()
}
Source Control
● Source control (or version control) is the practice of tracking and managing changes to code.
● Source control management (SCM) systems provide a running history of code development and help to
resolve conflicts when merging contributions from multiple sources.
● Whether you are writing a simple application on your own or collaborating on a large software development
project as part of a team, source control is a vital component of the development process.
● Source code management systems allow you to track your code change, see a revision history for your code,
and revert to previous versions of a project when needed.
● With source code management systems, you can collaborate on code with your team, isolate your work until
it is ready, and quickly troubleshoot issues by identifying who made changes and what the changes were.
● Source code management systems help streamline the development process and provide a centralized
source for all your code.
Source Control - Git
● Git is an open-source distributed source code management system.
● Git allows you to create a copy of your repository known as a branch.
● A branch is way to keep a set of commits together. By working on different branches, you can keep features
separated and reduce your risk of totally breaking your project.
● Using this branch, you can then work on your code independently from the stable version of your codebase.
● Once you are ready with your changes, you can store them as a set of differences, known as a commit.
● You can pull in commits from other contributors to your repository, push your commits to others, and merge
your commits back into the main version of the repository.
● Three Steps:
○ Commit
○ Pull
○ Push
Source Control - Contd.
Source Control - How it works in Xcode
● To understand how Source Control works, open AppDelegate.swift and make some changes to the method
application(_:didFinishLaunchingWithOptions:)
● After you save the file, you will note that AppDelegate.swift now has an “M” badge next to the filename as
the image shown in Image-1. The “M” badge stands for “modified.” It means you have modified the file but
have not yet committed the changes to your local Git repository.
● The next step is to commit the changes made as shown in Image-2.
Source Control
● Once you click on commit, the
screen is split into two panes.
● The left pane shows the file in its
current state with all changes
made since the last commit.
● You can enter the commit message
and Commit the code.
Source Control
● Once you have committed the code, your next step is to pull the changes(if any) from the remote server to
your local repository (Image 1)
● The next step is to push your local changes to the server.
Other Useful features - Comparison
● Comparing versions is especially important when newly added code doesn’t work as it was expected and you
need to find any changes been made since the last stable version.
● To compare two different versions of a file, either use the View > Version Editor > Show Comparison View, or
click on the Version Editor button on the right-top corner of xcode, as shown below:
● Once you do any of the above, the editor splits up to two parts. The the left pane shows the current version
of the file, while the right one shows the previous revision.
● The known blue areas indicating the modified code are displayed, and that makes tracking down code
additions really easy.
● So, you can select any previous commit and watch the differences appeared between the two panes.
Other Useful features - Blame
● Further than comparing file versions,
Xcode allows to track down the person
who did a commit, as well as the one
who modified parts of code.
● This is a feature quite useful in cases of
projects in which work more than one
people.
● To use it, simply open the View >
Version Editor > Show Blame View
menu, or click on the Version Editor
button on the toolbar, and then select
the Blame option. Refer the image in
the previous slide.
● A window similar to the image will
appear to you.
Dependency Management - Cocoapods
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 40 thousand libraries
and is used in over 2.9 million apps. CocoaPods can help you scale your projects elegantly.
To create a new project with CocoaPods, follow these simple steps:
● Create a new project in Xcode as you would normally.
● Open a terminal window, and $ cd into your project directory.
● Create a Podfile. This can be done by running $ pod init.
● Open your Podfile. Pods would have created default values as below -
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
// mention the pods to be installed
end
Cocoapods - Contd.
● Mention the required cocoapods in the pod file and save it as below -
target 'ProjectName' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
Use_frameworks!
pod 'RealmSwift'
pod 'Crashlytics', '~> 3.9.3'
end
● Then enter the $ pod install command in the terminal to install the cocoapods.
● You have to always open the Xcode workspace instead of the Xcode project file for further development.
● You can import the installed pods in your files like below -
import Crashlytics
import RealmSwift
Signing Identities and Certificates
● Code signing your app lets users trust that your app has been created by a source known to Apple and that it
hasn’t been tampered with.
● All apps must be code signed and provisioned to launch on a device, to use certain services, to be distributed
for testing, or to be uploaded to iTunes Connect.
● Code signing uses cryptographic technology to digitally sign your app and installer package.
● You create signing identities—stored in your keychain—and certificates—stored in your developer
account—to sign and provision your app.
● These assets uniquely identify you or your team, so it’s important to keep them safe.
● Code signing is used in combination with your App ID, provisioning profile, and entitlements to ensure that:
○ Your app is built and signed by you or a trusted team member.
○ Apps signed by you or your team run only on designated development devices.
○ Apps run only on the test devices you specify.
○ Your app isn’t using app services you didn’t add to your app.
○ Only you can upload builds of your app to iTunes Connect.
Identifiers, Devices, and Profiles
● You use your developer account to manage the identifiers, devices, and profiles used to code sign your app,
enable it to launch on devices, and use certain app services.
● Xcode creates and manages these assets for you during development.
● When you’re ready to distribute your app for testing, you use your developer account to manage some of
these assets yourself.
● For example, you can create custom development provisioning profiles, and bulk register devices used for
testing.
App Deployment
● You must have an iTunes Connect app record to validate and upload your app to iTunes Connect. To create
your app record, read more on Creating an App Record.
● The bundle ID you enter in iTunes Connect must match the bundle ID in your Xcode project.
● After you upload your first build, you can’t change the bundle ID in iTunes Connect.
● Choose Product -> Archive in Xcode. In the Archives organizer, select the archive you want to upload, and
click “Upload to App Store.”
● In the dialog that appears, choose a team from the pop-up menu and click Choose.
● If necessary, Xcode creates a distribution certificate and distribution provisioning profile for you. The name
of the distribution provisioning profile begins with the text XC:.
● In the dialog that appears, review the app, its entitlements, and provisioning profile and click Upload.
● Xcode uploads the archive to iTunes Connect and iTunes Connect runs validation tests.
● If issues are found, read the error messages, and click Done.
App Deployment - Contd.
● For a complete list of issues you should fix before distributing your app, read App Store Review Guidelines.
For more information on the app review process, go to App Review.
● If no issues are found, click Done.
● Xcode transmits the archive to Apple, where the build is examined to determine whether it conforms to
Apple guidelines. If the build is rejected, correct the problems that were identified and upload a new build. If
you successfully upload your app, view the version and build of your app in iTunes Connect.
● If your build has been successfully uploaded and you are ready to submit your app to App Review, submit
your App to the Store.
Thank You

Weitere ähnliche Inhalte

Was ist angesagt?

Advance Android Application Development
Advance Android Application DevelopmentAdvance Android Application Development
Advance Android Application DevelopmentRamesh Prasad
 
Comparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android DevelopmentComparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android DevelopmentWillow Cheng
 
Android Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectAndroid Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectJoemarie Amparo
 
Introduction to Android Studio
Introduction to Android StudioIntroduction to Android Studio
Introduction to Android StudioMichael Pan
 
Android development basics
Android development basicsAndroid development basics
Android development basicsPramesh Gautam
 
#Code2Create:: Introduction to App Development in Flutter with Dart
#Code2Create:: Introduction to App Development in Flutter with Dart#Code2Create:: Introduction to App Development in Flutter with Dart
#Code2Create:: Introduction to App Development in Flutter with DartGDGKuwaitGoogleDevel
 
Android development orientation for starters v2
Android development orientation for starters v2Android development orientation for starters v2
Android development orientation for starters v2Joemarie Amparo
 
Android studio 2.0: default project structure
Android studio 2.0: default project structureAndroid studio 2.0: default project structure
Android studio 2.0: default project structureVyara Georgieva
 
Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?Bitbar
 
Smartface ile Crossplatform Uygulama Geliştirme
Smartface ile Crossplatform Uygulama GeliştirmeSmartface ile Crossplatform Uygulama Geliştirme
Smartface ile Crossplatform Uygulama GeliştirmeMobile İstanbul
 
Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Lars Vogel
 
Generating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving PerformanceGenerating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving PerformanceParesh Mayani
 
Basic android development
Basic android developmentBasic android development
Basic android developmentUpanya Singh
 
Android development training
Android development trainingAndroid development training
Android development trainingmaheswarimahi18
 
Selenium web driver_2.0_presentation
Selenium web driver_2.0_presentationSelenium web driver_2.0_presentation
Selenium web driver_2.0_presentationsayhi2sudarshan
 
Introduction To Android For Beginners.
Introduction To Android For Beginners.Introduction To Android For Beginners.
Introduction To Android For Beginners.Sandeep Londhe
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application DevelopmentBenny Skogberg
 

Was ist angesagt? (20)

Xcode 6 release_notes
Xcode 6 release_notesXcode 6 release_notes
Xcode 6 release_notes
 
Advance Android Application Development
Advance Android Application DevelopmentAdvance Android Application Development
Advance Android Application Development
 
Comparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android DevelopmentComparison between Eclipse and Android Studio for Android Development
Comparison between Eclipse and Android Studio for Android Development
 
Android Development Made Easy - With Sample Project
Android Development Made Easy - With Sample ProjectAndroid Development Made Easy - With Sample Project
Android Development Made Easy - With Sample Project
 
Introduction to Android Studio
Introduction to Android StudioIntroduction to Android Studio
Introduction to Android Studio
 
Android development basics
Android development basicsAndroid development basics
Android development basics
 
#Code2Create:: Introduction to App Development in Flutter with Dart
#Code2Create:: Introduction to App Development in Flutter with Dart#Code2Create:: Introduction to App Development in Flutter with Dart
#Code2Create:: Introduction to App Development in Flutter with Dart
 
Android development orientation for starters v2
Android development orientation for starters v2Android development orientation for starters v2
Android development orientation for starters v2
 
Android studio 2.0: default project structure
Android studio 2.0: default project structureAndroid studio 2.0: default project structure
Android studio 2.0: default project structure
 
Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?Different Android Test Automation Frameworks - What Works You the Best?
Different Android Test Automation Frameworks - What Works You the Best?
 
Smartface ile Crossplatform Uygulama Geliştirme
Smartface ile Crossplatform Uygulama GeliştirmeSmartface ile Crossplatform Uygulama Geliştirme
Smartface ile Crossplatform Uygulama Geliştirme
 
Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11 Android Introduction on Java Forum Stuttgart 11
Android Introduction on Java Forum Stuttgart 11
 
Synapseindia android apps application
Synapseindia android apps applicationSynapseindia android apps application
Synapseindia android apps application
 
Generating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving PerformanceGenerating efficient APK by Reducing Size and Improving Performance
Generating efficient APK by Reducing Size and Improving Performance
 
ID E's features
ID E's featuresID E's features
ID E's features
 
Basic android development
Basic android developmentBasic android development
Basic android development
 
Android development training
Android development trainingAndroid development training
Android development training
 
Selenium web driver_2.0_presentation
Selenium web driver_2.0_presentationSelenium web driver_2.0_presentation
Selenium web driver_2.0_presentation
 
Introduction To Android For Beginners.
Introduction To Android For Beginners.Introduction To Android For Beginners.
Introduction To Android For Beginners.
 
Android Application Development
Android Application DevelopmentAndroid Application Development
Android Application Development
 

Ähnlich wie iOS JSON APIs

Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshareSaleemMalik52
 
iPhone application development training day 1
iPhone application development training day 1iPhone application development training day 1
iPhone application development training day 1Shyamala Prayaga
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by CitytechRitwik Das
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications Concetto Labs
 
Part 2 android application development 101
Part 2 android application development 101Part 2 android application development 101
Part 2 android application development 101Michael Angelo Rivera
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakayaMbakaya Kwatukha
 
React Basic and Advance || React Basic
React Basic and Advance   || React BasicReact Basic and Advance   || React Basic
React Basic and Advance || React Basicrafaqathussainc077
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React NativeEric Deng
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorialAbid Khan
 
Introduction to Android and Java.pptx
Introduction to Android and Java.pptxIntroduction to Android and Java.pptx
Introduction to Android and Java.pptxGandhiMathy6
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop AppFajar Baskoro
 
Innovation Generation - The Mobile Meetup: Android Best Practices
Innovation Generation - The Mobile Meetup: Android Best PracticesInnovation Generation - The Mobile Meetup: Android Best Practices
Innovation Generation - The Mobile Meetup: Android Best PracticesSolstice Mobile Argentina
 

Ähnlich wie iOS JSON APIs (20)

Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
 
iPhone application development training day 1
iPhone application development training day 1iPhone application development training day 1
iPhone application development training day 1
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by Citytech
 
XCode8.0
XCode8.0XCode8.0
XCode8.0
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications
 
04 objective-c session 4
04  objective-c session 404  objective-c session 4
04 objective-c session 4
 
Part 2 android application development 101
Part 2 android application development 101Part 2 android application development 101
Part 2 android application development 101
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
 
Compose Camp - Session2.pdf
Compose Camp - Session2.pdfCompose Camp - Session2.pdf
Compose Camp - Session2.pdf
 
Android session 1
Android session 1Android session 1
Android session 1
 
React Basic and Advance || React Basic
React Basic and Advance   || React BasicReact Basic and Advance   || React Basic
React Basic and Advance || React Basic
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
 
django
djangodjango
django
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
 
Introduction to Android and Java.pptx
Introduction to Android and Java.pptxIntroduction to Android and Java.pptx
Introduction to Android and Java.pptx
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop App
 
CI & CD- mobile application
CI & CD- mobile applicationCI & CD- mobile application
CI & CD- mobile application
 
CI & CD- mobile application
CI & CD- mobile applicationCI & CD- mobile application
CI & CD- mobile application
 
Innovation Generation - The Mobile Meetup: Android Best Practices
Innovation Generation - The Mobile Meetup: Android Best PracticesInnovation Generation - The Mobile Meetup: Android Best Practices
Innovation Generation - The Mobile Meetup: Android Best Practices
 

Kürzlich hochgeladen

Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 

Kürzlich hochgeladen (20)

Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 

iOS JSON APIs

  • 2. JSON Web Services ● Javascript Object Notation ● The JSON data format is widely used across the modern web and it is one of the most common ways to transfer data. ● Many modern APIs, RESTful web services in particular, support the JSON data format. ● JSON is a commonly used data format that is used for communication between, for example, clients and servers. ● It is popular because of it's usability across virtually any mobile platform such as iOS, Android, Windows Phone, and web browsers. ● The code snippet on the right side is an example of the JSON data format. { "dataTitle": "JSON Tutorial!", "swiftVersion": 2.1 "users": [ { "name": "John", "age": 25 }, { "name": "Mark", "age": 29 }, { "name": "Sarah", "age": 22 } ], }
  • 3. JSON Web Services - Contd. As you can see in the code snippet, the JSON data format is easy to understand. JSON is structured using two collection types, dictionaries and arrays. Dictionaries contains one or more of key-value pairs and are enclosed by curly braces, {}. Arrays contain a list of ordered items and are enclosed by square brackets, []. Almost every programming language defines these collection types, which is why JSON is supported by nearly every every language around. The following is a list of the supported data types in a JSON object: ● String ● Number (integer, float, double, etc.) ● Boolean ● Array ● Dictionary Part of the reason why JSON is so popular is because it is easy to read by humans and it can also be easily parsed and serialized by machines. Parsing and serializing is when the machine takes in raw data and turns that into an object useable by the application.
  • 4. JSON Web Services - Sample func getIPAddress() { let session = URLSession.shared let urlPath = URL(string: "https://api.ipify.org/?format=json" ) var request = URLRequest(url: urlPath! as URL) request.httpMethod = "GET" let task = session.dataTask(with: request, completionHandler: {(data, response, error) in if(error == nil) { do { let JSON = try JSONSerialization.jsonObject(with: data!, options:JSONSerialization.ReadingOptions.allowFragments) print("IPAddress response is (JSON)") let ipAddressDict = JSON as! [String: Any] let ipAddress: String = ipAddressDict["ip"] as! String print(ipAddress) }
  • 5. JSON Web Services - Sample catch let JSONError as NSError { print("IPAddress API Error - (JSONError)") } } else { print("IPAddress API Error - (error!)") } }) task.resume() }
  • 6. Source Control ● Source control (or version control) is the practice of tracking and managing changes to code. ● Source control management (SCM) systems provide a running history of code development and help to resolve conflicts when merging contributions from multiple sources. ● Whether you are writing a simple application on your own or collaborating on a large software development project as part of a team, source control is a vital component of the development process. ● Source code management systems allow you to track your code change, see a revision history for your code, and revert to previous versions of a project when needed. ● With source code management systems, you can collaborate on code with your team, isolate your work until it is ready, and quickly troubleshoot issues by identifying who made changes and what the changes were. ● Source code management systems help streamline the development process and provide a centralized source for all your code.
  • 7. Source Control - Git ● Git is an open-source distributed source code management system. ● Git allows you to create a copy of your repository known as a branch. ● A branch is way to keep a set of commits together. By working on different branches, you can keep features separated and reduce your risk of totally breaking your project. ● Using this branch, you can then work on your code independently from the stable version of your codebase. ● Once you are ready with your changes, you can store them as a set of differences, known as a commit. ● You can pull in commits from other contributors to your repository, push your commits to others, and merge your commits back into the main version of the repository. ● Three Steps: ○ Commit ○ Pull ○ Push
  • 9. Source Control - How it works in Xcode ● To understand how Source Control works, open AppDelegate.swift and make some changes to the method application(_:didFinishLaunchingWithOptions:) ● After you save the file, you will note that AppDelegate.swift now has an “M” badge next to the filename as the image shown in Image-1. The “M” badge stands for “modified.” It means you have modified the file but have not yet committed the changes to your local Git repository. ● The next step is to commit the changes made as shown in Image-2.
  • 10. Source Control ● Once you click on commit, the screen is split into two panes. ● The left pane shows the file in its current state with all changes made since the last commit. ● You can enter the commit message and Commit the code.
  • 11. Source Control ● Once you have committed the code, your next step is to pull the changes(if any) from the remote server to your local repository (Image 1) ● The next step is to push your local changes to the server.
  • 12. Other Useful features - Comparison ● Comparing versions is especially important when newly added code doesn’t work as it was expected and you need to find any changes been made since the last stable version. ● To compare two different versions of a file, either use the View > Version Editor > Show Comparison View, or click on the Version Editor button on the right-top corner of xcode, as shown below: ● Once you do any of the above, the editor splits up to two parts. The the left pane shows the current version of the file, while the right one shows the previous revision. ● The known blue areas indicating the modified code are displayed, and that makes tracking down code additions really easy. ● So, you can select any previous commit and watch the differences appeared between the two panes.
  • 13. Other Useful features - Blame ● Further than comparing file versions, Xcode allows to track down the person who did a commit, as well as the one who modified parts of code. ● This is a feature quite useful in cases of projects in which work more than one people. ● To use it, simply open the View > Version Editor > Show Blame View menu, or click on the Version Editor button on the toolbar, and then select the Blame option. Refer the image in the previous slide. ● A window similar to the image will appear to you.
  • 14. Dependency Management - Cocoapods CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 40 thousand libraries and is used in over 2.9 million apps. CocoaPods can help you scale your projects elegantly. To create a new project with CocoaPods, follow these simple steps: ● Create a new project in Xcode as you would normally. ● Open a terminal window, and $ cd into your project directory. ● Create a Podfile. This can be done by running $ pod init. ● Open your Podfile. Pods would have created default values as below - platform :ios, '8.0' use_frameworks! target 'MyApp' do // mention the pods to be installed end
  • 15. Cocoapods - Contd. ● Mention the required cocoapods in the pod file and save it as below - target 'ProjectName' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks Use_frameworks! pod 'RealmSwift' pod 'Crashlytics', '~> 3.9.3' end ● Then enter the $ pod install command in the terminal to install the cocoapods. ● You have to always open the Xcode workspace instead of the Xcode project file for further development. ● You can import the installed pods in your files like below - import Crashlytics import RealmSwift
  • 16. Signing Identities and Certificates ● Code signing your app lets users trust that your app has been created by a source known to Apple and that it hasn’t been tampered with. ● All apps must be code signed and provisioned to launch on a device, to use certain services, to be distributed for testing, or to be uploaded to iTunes Connect. ● Code signing uses cryptographic technology to digitally sign your app and installer package. ● You create signing identities—stored in your keychain—and certificates—stored in your developer account—to sign and provision your app. ● These assets uniquely identify you or your team, so it’s important to keep them safe. ● Code signing is used in combination with your App ID, provisioning profile, and entitlements to ensure that: ○ Your app is built and signed by you or a trusted team member. ○ Apps signed by you or your team run only on designated development devices. ○ Apps run only on the test devices you specify. ○ Your app isn’t using app services you didn’t add to your app. ○ Only you can upload builds of your app to iTunes Connect.
  • 17. Identifiers, Devices, and Profiles ● You use your developer account to manage the identifiers, devices, and profiles used to code sign your app, enable it to launch on devices, and use certain app services. ● Xcode creates and manages these assets for you during development. ● When you’re ready to distribute your app for testing, you use your developer account to manage some of these assets yourself. ● For example, you can create custom development provisioning profiles, and bulk register devices used for testing.
  • 18. App Deployment ● You must have an iTunes Connect app record to validate and upload your app to iTunes Connect. To create your app record, read more on Creating an App Record. ● The bundle ID you enter in iTunes Connect must match the bundle ID in your Xcode project. ● After you upload your first build, you can’t change the bundle ID in iTunes Connect. ● Choose Product -> Archive in Xcode. In the Archives organizer, select the archive you want to upload, and click “Upload to App Store.” ● In the dialog that appears, choose a team from the pop-up menu and click Choose. ● If necessary, Xcode creates a distribution certificate and distribution provisioning profile for you. The name of the distribution provisioning profile begins with the text XC:. ● In the dialog that appears, review the app, its entitlements, and provisioning profile and click Upload. ● Xcode uploads the archive to iTunes Connect and iTunes Connect runs validation tests. ● If issues are found, read the error messages, and click Done.
  • 19. App Deployment - Contd. ● For a complete list of issues you should fix before distributing your app, read App Store Review Guidelines. For more information on the app review process, go to App Review. ● If no issues are found, click Done. ● Xcode transmits the archive to Apple, where the build is examined to determine whether it conforms to Apple guidelines. If the build is rejected, correct the problems that were identified and upload a new build. If you successfully upload your app, view the version and build of your app in iTunes Connect. ● If your build has been successfully uploaded and you are ready to submit your app to App Review, submit your App to the Store.