iOS development
app name retrieval
Swift programming
iOS programming
mobile app development

How to get the name of the running application in iOS

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

On iOS, you can easily get information about your own app, but you cannot inspect arbitrary running apps on the device. That limitation is intentional: iOS sandboxing prevents one app from enumerating or identifying other running apps for privacy and security reasons.

So the practical answer depends on what you mean by "running application." If you want your app's display name, bundle name, or process name, iOS exposes that through your bundle metadata and process information.

Get Your App's Display Name

The name users normally see on the home screen is usually stored in the CFBundleDisplayName key inside the app's Info.plist. If that key is not set, many apps fall back to CFBundleName.

Here is a simple Swift helper:

swift
1import Foundation
2
3func applicationDisplayName() -> String {
4    let bundle = Bundle.main
5
6    if let displayName = bundle.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String,
7       !displayName.isEmpty {
8        return displayName
9    }
10
11    if let bundleName = bundle.object(forInfoDictionaryKey: "CFBundleName") as? String,
12       !bundleName.isEmpty {
13        return bundleName
14    }
15
16    return "Unknown App"
17}
18
19print(applicationDisplayName())

This is usually what you want for UI, diagnostics, or logging.

Bundle Name, Bundle Identifier, and Process Name

These values are related, but they are not the same thing:

  • 'CFBundleDisplayName is the user-facing display name.'
  • 'CFBundleName is the internal bundle name.'
  • 'bundleIdentifier is the unique reverse-domain identifier.'
  • 'ProcessInfo.processName is the current executable process name.'

You can inspect all of them in one place:

swift
1import Foundation
2
3let bundle = Bundle.main
4
5let displayName = bundle.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String
6let bundleName = bundle.object(forInfoDictionaryKey: "CFBundleName") as? String
7let bundleIdentifier = bundle.bundleIdentifier
8let processName = ProcessInfo.processInfo.processName
9
10print("Display name:", displayName ?? "nil")
11print("Bundle name:", bundleName ?? "nil")
12print("Bundle identifier:", bundleIdentifier ?? "nil")
13print("Process name:", processName)

For analytics and system integration, the bundle identifier is usually the most stable choice. For labels shown to users, prefer the display name.

If You Mean App State

Sometimes the question is really about whether the app is active, inactive, or in the background. iOS lets your app observe its own lifecycle state, but still not the full state of unrelated apps.

swift
1import UIKit
2
3func describeAppState() -> String {
4    switch UIApplication.shared.applicationState {
5    case .active:
6        return "active"
7    case .inactive:
8        return "inactive"
9    case .background:
10        return "background"
11    @unknown default:
12        return "unknown"
13    }
14}
15
16print(describeAppState())

That can be useful for debugging why certain code runs only in the foreground, or why a network task is being deferred.

What You Cannot Do

You cannot ask iOS for "the name of the currently running application" in the desktop operating system sense. There is no public API that tells your app which other app is currently on screen or what other apps are running in the background.

The only limited cross-app checks available are mechanisms such as canOpenURL, app groups for apps you own, and system APIs with specific entitlements. None of those provide a general list of running applications.

That distinction matters because many developers come from desktop environments where process enumeration is normal. On iOS, that model does not apply.

A Small Utility Wrapper

If you need this information in multiple places, wrap it in a lightweight type:

swift
1import Foundation
2
3struct AppInfo {
4    let displayName: String
5    let bundleName: String
6    let bundleIdentifier: String
7    let processName: String
8
9    static func current() -> AppInfo {
10        let bundle = Bundle.main
11        let displayName = (bundle.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String)
12            ?? (bundle.object(forInfoDictionaryKey: "CFBundleName") as? String)
13            ?? "Unknown App"
14
15        return AppInfo(
16            displayName: displayName,
17            bundleName: bundle.object(forInfoDictionaryKey: "CFBundleName") as? String ?? "",
18            bundleIdentifier: bundle.bundleIdentifier ?? "",
19            processName: ProcessInfo.processInfo.processName
20        )
21    }
22}
23
24let info = AppInfo.current()
25print(info.displayName)

This keeps the call sites clean and centralizes fallback behavior.

Common Pitfalls

  • Expecting iOS to reveal other running apps. Public APIs do not allow general app enumeration.
  • Using CFBundleName when you actually need the user-visible app name. Prefer CFBundleDisplayName first.
  • Assuming the process name and the display name are identical. They often differ.
  • Forgetting that localization can affect display names if your Info.plist is localized.

Summary

  • Use CFBundleDisplayName to get the user-facing name of your own iOS app.
  • Fall back to CFBundleName if no display name is configured.
  • Use bundleIdentifier for stable internal identification.
  • Use ProcessInfo.processName when you need the executable process name.
  • You cannot use public iOS APIs to identify arbitrary other running applications.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.