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
110
votes
21 answers

Why do I get iOS linker errors with my static libraries?

I have a problem with linking my mixed language framework to a project. I create a framework with Swift and Objective-C classes. The main logic was stored in the Swift file. For example the class with a method that calls NSLog("Swift log was…
110
votes
7 answers

Is there a UIView resize event?

I have a view that has rows and columns of imageviews in it. If this view is resized, I need to rearrange the imageviews positions. This view is a subview of another view that gets resized. Is there a way to detect when this view is being resized?
live-love
  • 48,840
  • 22
  • 240
  • 204
110
votes
6 answers

Swift - check if a timestamp is yesterday, today, tomorrow, or X days ago

I'm trying to work out how to decide if a given timestamp occurs today, or +1 / -1 days. Essentially, I'd like to do something like this (Pseudocode) IF days_from_today(timestamp) == -1 RETURN 'Yesterday' ELSE IF days_from_today(timestamp) == 0…
Ben
  • 4,707
  • 5
  • 34
  • 55
110
votes
1 answer

Speed up fetching posts for my social network app by using query instead of observing a single event repeatedly

I have an array of keys which lead to post objects for my social network like so /posts/id/(post info) When I load the posts I load /posts/0 and then /posts/1 etc using the observeSingleEventOfType(.Value) method. I use a lazyTableView to load 30 at…
Big_Mac
  • 2,975
  • 4
  • 20
  • 36
110
votes
4 answers

Behaviour for significant change location API when terminated/suspended?

This is the section from the CLLocationManager documentation describing the app behavior with startMonitoringSignificantLocationChanges: If you start this service and your application is subsequently terminated, the system automatically …
110
votes
1 answer

Receiving kAUGraphErr_CannotDoInCurrentContext when calling AUGraphStart for playback

I'm working with AUGraph and Audio Units API to playback and record audio in my iOS app. Now I have a rare issue when an AUGraph is unable to start with the following error: result = kAUGraphErr_CannotDoInCurrentContext (-10863) The error occurred…
Mando
  • 11,414
  • 17
  • 86
  • 167
110
votes
12 answers

The app delegate must implement the window property if it wants to use a main storyboard file swift

I have just developed an app, but when running in the simulator the debugger console says: The app delegate must implement the window property if it wants to use a main storyboard file. I have an app delegate file. What does the message…
Ethan Marcus
  • 1,266
  • 2
  • 9
  • 12
110
votes
9 answers

error: module file's minimum deployment target is ios8.3 v8.3

All attempts to import a dynamic framework in an Xcode playground yield the following error: error: module file's minimum deployment target is ios8.3 v8.3
Vatsal Manot
  • 17,695
  • 9
  • 44
  • 80
110
votes
20 answers

How to allow user to pick the image with Swift?

I am writing my first iOS application (iPhone only) with Swift. The main application view should allow user to choose the image from the photo gallery. I've found the following sample code of ViewController.swift: class ViewController:…
LA_
  • 19,823
  • 58
  • 172
  • 308
110
votes
13 answers

Returning data from async call in Swift function

I have created a utility class in my Swift project that handles all the REST requests and responses. I have built a simple REST API so I can test my code. I have created a class method that needs to return an NSArray but because the API call is…
Mark Tyers
  • 2,961
  • 4
  • 29
  • 52
110
votes
8 answers

CALayers didn't get resized on its UIView's bounds change. Why?

I have a UIView which has about 8 different CALayer sublayers added to its layer. If I modify the view's bounds (animated), then the view itself shrinks (I checked it with a backgroundColor), but the sublayers' size remains unchanged. How to solve…
Geri Borbás
  • 15,810
  • 18
  • 109
  • 172
110
votes
6 answers

How to convert an Int to Hex String in Swift

In Obj-C I used to convert an unsigned integer n to a hex string with NSString *st = [NSString stringWithFormat:@"%2X", n]; I tried for a long time to translate this into Swift language, but unsuccessfully.
boscarol
  • 1,901
  • 2
  • 15
  • 29
110
votes
4 answers

Create UIActionSheet 'otherButtons' by passing in array, not varlist

I have an array of strings that I want to use for button titles on a UIActionSheet. Unfortunately, the otherButtonTitles: argument in the method invocation takes a variable length list of strings, not an array. So how I can I pass these titles into…
Greg Maletic
  • 6,225
  • 8
  • 54
  • 73
110
votes
18 answers

iOS change navigation bar title font and color

So i have this code that should change the nav bar title font, but it doenst NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont …
aZtraL-EnForceR
  • 1,781
  • 2
  • 16
  • 19
110
votes
18 answers

Get notified when UITableView has finished asking for data?

Is there some way to find out when a UITableView has finished asking for data from its data source? None of the viewDidLoad/viewWillAppear/viewDidAppear methods of the associated view controller (UITableViewController) are of use here, as they all…
kennethmac2000
  • 1,281
  • 2
  • 10
  • 7