Found 95 Articles for IPhone/iPad

What is Xcode error “Could not find Developer Disk Image”?

Nancy Den
Updated on 27-Jun-2020 13:25:20

843 Views

The Xcode error occurs when the xcode version and ios versions don’t match. Usually it happens when the Xcode version is less than the device iOS version. i.e. the Xcode is too old for the device. This is a compatibility issue which can be resolved by performing some steps.Always check if the device you are using has compatible iOS version to the Xcode version, if not Xcode requires an update.If you are not able to update XCode or there is no update being shown for Xcode, please check if the OS needs an update.In some cases you would not like ... Read More

How to take a screenshot programmatically in iPhone/iOS?

Nitya Raut
Updated on 27-Jun-2020 13:26:08

1K+ Views

Though iOS does not provide any official way to take screenshots on iOS device programmatically, it provides a way to screenshot using the home and power button, by pressing both of them at the same time.To take a screenshot, we’ll have to go through a series of steps.We’ll get the layer of keyWindow – UIApplication.shared.keyWindow!.layerWe’ll get the scale of screen – UIApplication.main.scaleCreating a new image with same size as the view.Render and save the image.Let’s create a new project, in the main view controller give some background color and then drag a button and connect to create an action to ... Read More

How to exit iPhone application gracefully?

Nishtha Thakur
Updated on 27-Jun-2020 13:28:13

540 Views

There are times we would like to close our application due to some reason, for example if there is no internet connection and you’d like to kill the app, or any other reason according to the application. Though apple prefers not quitting the application, hence it is not supported in any of the applications.The only way to logically kill an iOS application is by pressing the home button. As soon as the home button is pressed, and the application exits the memory is freed up and cleaned.Still there are other ways to quit an application.exit − this command may be ... Read More

How to URL encode a string (NSString) in iPhone?

Smita Kapse
Updated on 27-Jun-2020 13:28:31

623 Views

When developing API based web applications we definitely need to interect with Multiple web services and URLs. The url may contain special character, search terms, queries, headers and many other things depending on the service we need. That’s why we need to have some kind of encoding so that the URL we are creating and the URL being called are same.To achieve the same with Objective C we can use −#import "NSString+URLEncoding.h" @implementation NSString (URLEncoding) -(NSString *)urlEncodeUsingEncoding:(NSStringEncoding)encoding {    return (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,    (CFStringRef)self, NULL, (CFStringRef)@"!*'\"();:@&=+$, /?%#[]% ", CFStringConvertNSStringEncodingToEncoding(encoding)); } @endAnother way to achieve URL encoding in Objective C is ... Read More

How to parse JSON object in iPhone/iOS?

Nancy Den
Updated on 27-Jun-2020 13:29:49

545 Views

JSON stands for Javascript object notation. Most of the when dealing with APIs or any other services the data is returned in JSON format and we need to convert it to usable and supporte language formats.Foundation framework of iOS provides a class JSONSerialization to convert JSON into supported formats like Dictionary, strings, Bool etc.The JSONSerialization class provides a method jsonObject(with:options:) that parses json and returns Any as result, and an error if the data cannot be parsed.// Example JSON: /* {    "age": 42.0,    "name": {       "firstName": “tut”    } } */Let’s see this with help ... Read More

What are all the custom URL schemes supported by the Facebook iPhone app?

Jennifer Nicholas
Updated on 27-Jun-2020 13:31:00

901 Views

A url Scheme is a way of iOS to open some third party applications from within a app. Some of the URL schemes that are supported by facebook to open different modules of facebook app from within some other app are mentioned below.1. To open facebook profile: fb://profile 2. To open request list: fb://requests 3. To open friends list : fb://friends 4. To open notes: fb://notes 5. To open the list of notifications : fb://notifications 6. To open albums: fb://albums 7. To open feeds/ home : fb://feed 8. To open events : fb://events 9. To open a page with id: ... Read More

How to launch any arbitrary iPhone application from within another app?

Nitya Raut
Updated on 27-Jun-2020 13:31:34

980 Views

iOS Allows us to open some applications with some links or other ways from our app, like dialing a number when clicked on it, or writing a mail with some static body or writing a SMS. But this is limited to some applications, not every app can be opened from within an application.Specifically it is limited to apps that have a registered URL Scheme. For example if you want to open a SMS from your app, it is possible using the registered URL Scheme.Some of the applications that can be opened with URL schemes and how to open them are ... Read More

Set up a simple delegate to communicate between two view controllers in iPhone

Anvi Jain
Updated on 27-Jun-2020 13:35:40

723 Views

In this article, you learn about delegates and creating delegates. First of all, What’s a delegate?Delegate is a simple term that refers to communication between objects. It is a simple way of connecting objects and communication between them.How does delegate work?A delegate is created with help of protocol. A protocol is declared in class, inside which some event will happen, that should notify other classes. In protocol we write the declaration of function and it is defined inside the calling class.How to create a delegate?We’ll do this with help of an example project.Steps to perform −Create a class, name it ... Read More

How to detect the screen size of iPhone 5?

Jennifer Nicholas
Updated on 27-Jun-2020 13:39:48

226 Views

Detecting screen size of an apple device is an easy and simple task. The UIKIT module of iOS SDK provides many functions and classes that deal with user interface, screen sizes and many other UI elements.One of them is UIScreen which deals with the device screen.UIScreen.main provides the current main screen of the device in use, which further has methods that return other features and properties of the current screen.To find if the current screen is an iPhone 5 or not, we’ll first have to find the current size of the screen and compare with a value. The height of ... Read More

How to determine the current iPhone model information?

Nitya Raut
Updated on 27-Jun-2020 13:40:26

510 Views

iOS Provides a UIDevice class which has all the information about your iPhone that does not violate any privacy laws Apple has.Using the UIDevice we can access information like −UIDevice.current.localizedModel − this returns the localized version of modelUIDevice.current.model − this returns model of current device, e.g. @"iPhone", @"iPod touch"UIDevice.current.name − this returns the current name of the device in use, e.g. "My iPhone"UIDevice.current.systemName − this returns the system name e.g. @"iOS"UIDevice.current.systemVersion − this returns the system version e.g. @"4.0"UIDevice.current.batteryLevel − this returns the battery level, if it is between 0 to 1, it will return the value otherwise if the ... Read More

Advertisements