Questions tagged [ios]

iOS is the mobile operating system running on the Apple iPhone, iPod touch, and iPad. Use this tag [ios] for questions related to programming on the iOS platform. Use the related tags [objective-c] and [swift] for issues specific to those programming languages.

It should not be confused with i5/OS, which is one of IBM's operating systems for the IBM Power Systems (originally AS/400), or with Cisco's IOS (Inter-network Operating System).

iOS Latest Stable Release: iOS 16.3.1 (20D67) released on February 13, 2023

Latest Preview: iOS 16.4 RC beta (20E246) released on March 21, 2023

Latest Release News: News and Updates

iOS is a derivative of Apple's OSX desktop operating system, with which it shares many (but not all) common frameworks and other components. These include Cocoa Touch (the counterpart of the OS X Cocoa UI Framework), the Mach/Darwin/XNU kernel and code from the Berkeley Software Distribution (BSD).

Applications for iOS are written for the Cocoa Touch framework (as opposed to OS X's Cocoa framework) using the same Xcode IDE for official use (i.e. for submitting applications to Apple's App Store) or using unofficial (mostly command-line only) toolchains for various operating systems (including Linux) for unofficial/jailbroken development. OS X is based on the Darwin-OS foundation, itself based on several Unix descendants. On June 2nd, 2014, Apple announced a new language, Swift, which could be used to develop apps for iOS. Swift was in beta until September 9th, 2014, and is, since September 17th, 2018, at version 4.2.0.

Each iOS application runs in its own secure sandbox to prevent (accidentally or intentionally) altering other applications, the operating system, or any other data. Since iOS 8, an iOS application can have extensions that extend custom functionality beyond the application. iOS is optimized for the power, graphics, processor, and memory constraints of mobile devices.

The user interface of iOS is based on the concept of direct manipulation through multi-touch gestures. Interface control elements consist of sliders, switches, and buttons, all included in Apple's UIKit Framework. Interaction with the OS includes gestures such as swipe, tap, pinch, and reverse pinch, all of which have specific definitions within the context of the iOS operating system and its multi-touch interface.

Internal accelerometers and gyroscopes can be used by applications to respond to the user shaking the device (one application is the undo command) or rotating it in three dimensions (one common result is switching from portrait to landscape mode or autorotation).

Apple initially adapted features from OS X to create iOS, but that cycle is now bidirectional. Many features on OS X 10.7 OSX Lion were implemented first in iOS, including application sandboxing, an OS X App Store (and the implied widespread third-party app code signing), the content-centric ("natural") scrolling direction, along with AV Foundation, Core Location, and a few other frameworks.

Swift Package Manager or SPM is a dependency manager tool from Apple for managing the distribution of the Swift code. Introduced with Swift 3.0, it is slowly becoming the dominant dependency tool in Swift and Objective-C projects. The basic concepts of the SPM are:

  • Modules - Swift code are organized in modules that specify the namespace and enforce access control of the code.
  • Packages - are reusable components of code used in the projects and at the moment these languages are supported: Swift, Objective-C, Objective-C++, C, or C++
  • Products - library or executable
  • Dependencies - modules on which code in the packages depends on

It comes as a part of the Xcode IDE Swift packages or as part of the Swift toolchains. The source code can be found here.

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It includes almost ten thousand libraries to help programmers scale projects. A popular alternative is Carthage, which is a decentralized dependency manager, meaning that it does not store a central list of available projects.

Use the tag for questions about Cisco's IOS operating system for Cisco network routers.

Please follow the article My App Crashed, Now What? by Ray Wenderlich, before posting any questions relating to app crashes. It explains how to properly debug an iOS app. It's pointless to ask questions relating to crashes when you don't have a proper backtrace and exception message.

Before you ask about custom controls: I want this type of control. Please visit cocoacontrols once. You will get lots of custom controls, animation, libraries, and much more which are available in Swift and Objective-C.

Before asking about a topic, just search for it in https://developer.apple.com/documentation/ also, which is the developer documentation provided by Apple that covers a lot of information regarding iOS development.


Resources


Chat Rooms

Chat about iOS with other Stack Overflow users


If you are moving from Objective-C to Swift, but you don't know anything about Swift, then you can convert your Objective-C code/project to Swift. Use the following third-party link.

Related Tags

Platforms:

Programming languages:

IDE:

Frameworks & extensions:

Distribution:

683185 questions
113
votes
14 answers

Get current URL of UIWebView

I already tried getting the current URL of my UIWebView with: webview.request.URL. Unfortunately the NSURL was empty. Anything wrong here? I am working with Xcode 3.2.2 beta 5. The code above should be executed in the UIWebView delegate…
danielreiser
  • 5,292
  • 5
  • 31
  • 43
113
votes
16 answers

Getting version and build information with Swift

I am attempting to gain access to the main NSBundle to retrieve version and build information. Thing is, I want to try it in Swift, I know how to retrieve it in Objective-C with: text = [NSBundle.mainBundle.infoDictionary…
Ken-UbiDex
  • 1,213
  • 2
  • 8
  • 7
113
votes
5 answers

How to convert this var string to URL in Swift

I need url filepath be a URL (NSURL in old versions of Swift). I have this: let paths = NSSearchPathForDirectoriesInDomains( .documentDirectory, .userDomainMask, true) // NSString *documentsDirectory = [paths objectAtIndex:0]; let…
user3745888
  • 6,143
  • 15
  • 48
  • 97
113
votes
17 answers

scale Image in an UIButton to AspectFit?

I want to add an image to a UIButton, and also want to scale my image to fit with the UIButton (make image smaller). Please show me how to do it. This is what I have tried, but it does't work: Adding image to button and using…
KONG
  • 7,271
  • 6
  • 28
  • 27
113
votes
6 answers

iOS 7 style Blur view

Does anybody know of any controls that will replicate the iOS7 style blur views. I'm assumming there can be some kind of UIView subclass that will replicate the behavior. I'm talking about these type views which blur the background extremely…
endy
  • 3,872
  • 5
  • 29
  • 43
113
votes
33 answers

How disable Copy, Cut, Select, Select All in UITextView

The UITextView's Copy, Cut, Select, Select All functionality is shown by default when I press down on the screen. But, in my project the UITextField is only read only. I do not require this functionality. Please tell me how to disable this feature.
Aishwarya
  • 1,587
  • 3
  • 14
  • 9
113
votes
16 answers

Removing viewcontrollers from navigation stack

I have a navigation stack, with say 5 UIViewControllers. I want to remove the 3rd and 4th viewcontrollers in the stack on the click of a button in the 5th viewcontroller. Is it possible to do this? If so how?
Jean Paul
  • 2,389
  • 5
  • 27
  • 37
112
votes
8 answers

Programmatically retrieve memory usage on iPhone

I'm trying to retrieve the amount of memory my iPhone app is using at anytime, programmatically. Yes I'm aware about ObjectAlloc/Leaks. I'm not interested in those, only to know if it's possible to write some code and get the amount of bytes being…
Coocoo4Cocoa
  • 48,756
  • 50
  • 150
  • 175
112
votes
11 answers

"Application tried to present modally an active controller"?

I just came across a crash showing a NSInvalidArgumentException with this message on an app which wasn't doing this before. Application tried to present modally an active controller UITabBarController: 0x83d7f00. I have a UITabBarController…
Javier Soto
  • 4,840
  • 4
  • 26
  • 46
112
votes
26 answers

How to set top-left alignment for UILabel for iOS application?

I have added one label in my nib file, then its required to have top-left alignment for that lable. As I am providing text at runtime so its not sure that how much lines there are. So if text contains only single line then it appears as…
Mrunal
  • 13,982
  • 6
  • 52
  • 96
112
votes
7 answers

Undocumented NSURLErrorDomain error codes (-1001, -1003 and -1004) using StoreKit

I'm writing StoreKit-related code, and I'm getting some rather troubling error codes when I try to add a purchase to the queue. So far, I've experienced error codes -1003 and -1004 and I can't find anything about those codes on the internet. Running…
Hyperbole
  • 3,917
  • 4
  • 35
  • 54
112
votes
2 answers

Problem setting video frame rate using AVAssetWriter/AVAssetReader

Situation: I am trying to export video with some parameters like video bit rate, audio bit rate, frame rate, changing video resolution, etc. Note that I am letting the user set the video frame rate in fractions; like user can set the video frame…
Sunil Chauhan
  • 2,074
  • 1
  • 15
  • 33
112
votes
8 answers

Prevent dialog from closing on outside touch in Flutter

In Flutter, I write a simple dialog for the loader during async task. When I touch outside dialog dismissed, How can I stop this behaviour? Code showDialog( context: context, builder: (_) => new Dialog( child: new Container( …
Magesh Pandian
  • 8,789
  • 12
  • 45
  • 60
112
votes
13 answers

Flutter: How to create a new project

I installed Flutter SDK, following steps, provided from this link: Install on macOS - iOS setup. But I am unable to create a new sample project in Xcode. I can't find a proper way to start a new project using Xcode. Here are steps to start a new…
Krunal
  • 77,632
  • 48
  • 245
  • 261
112
votes
3 answers

Using a BOOL property

Apple recommends to declare a BOOL property this way: @property (nonatomic, assign, getter=isWorking) BOOL working; As I'm using Objective-C 2.0 properties and dot notation, I access this property using self.working. I know that I could also use…
Patrick
  • 3,091
  • 4
  • 26
  • 29