/r/iOSProgramming

Photograph via snooOG

A subreddit to discuss, share articles, code samples, open source projects and anything else related to iOS, macOS, watchOS, tvOS, or visionOS development.

FAQ

About

There is an extensive FAQ for beginners. Please browse it first before asking questions that are answered there.

If you are looking to get started (iOS programming in general or some specific area), here are more relevant links for you:

  • Swift or Objective-C? if you don't know which language to choose. (New posts asking this will be removed)

Related Subreddits

Related Links

There's too many to list them all, however here's a convenient link to all programming guides at apple.com

Take note that this list is live and based on most frequent questions in posts will be updated with "quicklinks".

/r/iOSProgramming

148,950 Subscribers

2

Try Meet with Apple for to resolve reject build version AppStore Connect

Hello, our app is being rejected with the error Guideline 4.3(a) - Design - Spam.

I am planning to solve the problem by:

Request a 30-minute online meeting with an App Review expert to discuss the guidelines and best practices for a smooth review process.

Is this a solution, and what should I prepare for the meeting?

Looking forward to receiving your experience in handling this case.

Note: We are a non-US or EU development team.

2 Comments
2024/11/15
02:38 UTC

0

Scared to publish multiple apps on iOS app store

So I've been having an iOS app built by a developer and it's in review process.

Now I have another iOS app that I built on my own and is almost ready to publish.

I also have 2 other Mac apps that might be ready to publish soon. Building myself as well.

I heard from the developer that Apple does not like people who publish too many apps.

The iOS apps are an AI wrapper and somewhat of a novel utility.

The Mac apps are utilities that I built for myself.

So I'm kind of scared of publishing them too closely together and want to see if anyone has any experience with this or recommendations or best practices.

9 Comments
2024/11/15
00:50 UTC

5

Cautiously optimistic that Apple fixed DeviceCheck validation times

I have made no code changes to our backend in the last three days. The p99 of DeviceCheck validation was previously unpredictable. You can see in the last 3 days, suddenly the p99 is only marginally above the P50. Not sure how many others here perform DeviceCheck validation, but if so would love to see if your data corroborates!

https://preview.redd.it/ocq1tnelux0e1.png?width=2254&format=png&auto=webp&s=009c1bea2346c0fbaa243891450c170d6f83f629

1 Comment
2024/11/14
21:56 UTC

2

How to fix error "Couldn't write values for keys() in CFPrefsPlistSource" with "UserDefaults.standard" when device is closed/locked?

I am trying to write a value to UserDefaults.standard in iOS swift. It works without a problem when the app is running, but I get an error when the device is closed/locked and I trigger the code via remote notification:

Code:

UserDefaults.standard.set("abc", forKey: "abc")
print("TEST \(UserDefaults.standard.string(forKey: "abc"))")

Output:

Couldn't write values for keys (
    abc
) in CFPrefsPlistSource<0x3037e0480> (Domain: com.example, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): Path not accessible
Not updating lastKnownShmemState in CFPrefsPlistSource<0x3037e0480> (Domain: com.example, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): 78213 -> 78213

TEST Optional("abc")

Is there a way to fix this or work around?

I had a remotely similar issue when downloading and saving files ("access denied"), had to use URLSession.shared.data and data.write(to: destinationURL, options: .completeFileProtectionUntilFirstUserAuthentication) to keep it working when the device is closed/locked and code is triggered via remote notification. But how could that be applied to UserDefaults.standard?

2 Comments
2024/11/14
21:36 UTC

1

Should I be worried about these memory leaks?

are they coming from the system itself, or are they something I should address?

https://preview.redd.it/3ru14csrfx0e1.png?width=2270&format=png&auto=webp&s=0a0bcd1614e20de6e329c8925fa620a5fd8cd6d3

2 Comments
2024/11/14
20:29 UTC

41

Plain M4 beats M2 Pro in Xcode benchmarks

It is wild, but entry level M4 now beats M2 Pro in the Xcode benchmarks: https://github.com/devMEremenko/XcodeBenchmark

This progress is amazing, but it also makes one implication - Pro devices aren't that good investment anymore.

Historically you could buy a Pro device and use it for 5 years or even more, that is why they were very popular. Now it seems to be more sound to spend 2x less for some entry model and replace it every other year...

30 Comments
2024/11/14
18:22 UTC

1

How to setup a modularized Xcode project for The Composable Architecture

0 Comments
2024/11/14
16:24 UTC

222

My app just became top 10 paid. Looking for tips on momentum.

70 Comments
2024/11/14
14:32 UTC

0

How did you implement the beckend for your subscriptions?

I wonder how you guys implemented it would love to learn more and do it the best way

12 Comments
2024/11/14
13:39 UTC

5

How to Integrate Live Activity and Dynamic Island in iOS

With the release of iOS 16, Apple introduced Live Activities, and later with iPhone 14 Pro, the Dynamic Island—two powerful tools that allow us to present real-time, glanceable updates directly on the Lock Screen and at the top of the screen on the Dynamic Island.

These features are designed to keep users informed about ongoing activities, like delivery tracking, live sports scores, or wait times, without requiring them to unlock their devices or open the app.

In this two-part guide, we’ll discuss everything you need to know to integrate Live Activities and Dynamic Island effectively in your iOS app.

We'll detail each step from understanding design constraints to setting up a Live Activity, handling updates, and adding interactions.

What we're going to cover in this first part,

  • What Are Live Activities and Dynamic Island?
  • Live Activity presentations and constraints
  • Design layout for different presentations
  • Start, update, and end the activity

Live Activity Demo in iOS

Blog Post — https://canopas.com/integrating-live-activity-and-dynamic-island-in-i-os-a-complete-guide

Video Tutorial — https://youtu.be/AtxuTtUa3NI?si=TK1QITFDB7i6dI-r

0 Comments
2024/11/14
12:06 UTC

1

Do you know Design Systems and how to setup an effective one for you Mobile App?

I will be sharing series of articles on what are design systems and how you can implement it in your mobile app developemnt process. If you are interested please let me know what you want me to write about?

I will going through:

  1. Design tokens
  2. Tools to export tokens and create documentation
  3. Converting tokens to code
  4. Setup system to automate the handoff of the designs.

https://medium.com/@tarang0510/the-missing-piece-in-mobile-development-why-design-systems-matter-more-than-you-think-chapter-1-ed4d8fc03476

0 Comments
2024/11/14
03:05 UTC

2

Is my app payment model IAP?

I'm developing an app which has the following forms of payment:

  1. Brands to us - a brand purchases a subscription from us that enable brands to set up their accounts so that the members can then purchase a membership to the brands.
  2. Members to brand - a member purchases a membership set up by the brand (products have to be created dynamically for each brand and prices are manually configured by the brand). This enables a member to get access to certain benefits from the brand (such as a gym membership for a gym business or VIP privileges for a hotel business). Basically, use the purchased membership as a membership card IRL.

Our business ultimately is for physical services. Apps like Uber also has subscriptions and passes, but they're not eligible for IAP. Would our model be considered IAP-eligible then? There's a murky line between what is IAP and what's not, and I'm really confused where my business model falls in. Please help me understand.

6 Comments
2024/11/14
08:57 UTC

2

AppShortcutsProvider, siri asks which app to use

Im using AppShortcutsProvider to provide shortcuts and siri phrases for my app intents. My phrases look like:

phrases: [

"Make a payment to \(.applicationName)",

"Make a payment with \(.applicationName)",

"Pay \(.applicationName)",

"Pay my \(.applicationName) bill",

],

When i use siri and invoke one of those phrases Siri brings up a dialog and asks which app I'd like to use:
My App
or
Wallet

is there any way to avoid this and have it go straight to my shortcut?

1 Comment
2024/11/14
04:25 UTC

2

Access debug logs of a user

Hi fellow developers,

I have an app live on app store and one of the user is complaining of a bug that I can't reproduce. Is there a way I can access logs from their device? Something which is easy for a non technical person to do.

3 Comments
2024/11/14
03:42 UTC

1

Notifications icon - iOS 18.1+

I have an app that displays local notifications on iOS. In versions prior to iOS 18.1, changing the app icon would automatically update the notification icon as well. However, in version 18.1, the notification icon remains the same, regardless of any changes to the app icon. Does anyone know how to work around this limitation?

2 Comments
2024/11/14
02:44 UTC

2

Interview Terminologies

Hello everyone, I’ve been coding in Swift for a while and I feel solid with the actual coding, But I worry that in future interviews if I ever have, I might get thrown off by technical terms I already know in practice but not by name. It’s frustrating because I understand the concepts and use them regularly, but I might struggle to connect what I know to the ‘fancy’ terms if interviewers use, like ‘pattern matching’ or ‘trailing closures.’ Has anyone else faced this? How can I better prepare for the terminology side of interviews so I don’t feel caught off guard?

2 Comments
2024/11/14
02:42 UTC

5

How should I encrypt the code in my iOS project?

I help clients solve some issues with their products, and they need us to provide this as an iOS SDK. Our SDK runs locally and is eventually integrated into their code, so we cannot provide it through a remote API. Do you have any good solutions for this?

18 Comments
2024/11/14
02:29 UTC

1

Alternative ways to transport audio buffer in realtime?

So I've posted about this before how my websocket was getting turned off when the screen was turned off or switching apps. I'm using react native.

With regard to the capabilities you can choose I had seen push notifications and background processing. I'm not sure how other apps that do real-time dictation do it, is it a local speech model maybe that's shipped with the app vs. sending buffer chunks?

2 Comments
2024/11/13
22:45 UTC

0

CarPlay. Has anyone made an app with CarPlay. And if so, what did you do to code it.

I was just thinking about making a CarPlay app and was just wondering this. I couldn’t get it to work in Xcode and then looked at apples doc. Not sure if I did it correctly or not. Thanks for any help you may provide.

4 Comments
2024/11/13
22:38 UTC

1

ATT Prompt for App

Working with a recently launched app and running their paid ad campaigns on social/search. the founder doesn't want to show the ATT prompt because of the verbiage.

does anyone know what happens if you try to run paid media to the app? i haven't worked with anyone who didn't show the prompt. i'm assuming our ad campaigns are just going to perform much less efficiently BUT i know ATT opt in is quite low so not sure how much it actually helps ad campaigns anyway.

Anybody have experience with this?

1 Comment
2024/11/13
21:50 UTC

1

Possible to change left bar color in Xcode?

Is there a workaround to change the color of left bar to a custom color in Xcode. The color of the left bar is not contrasting well with my custom Xcode theme. I have tried everything.

0 Comments
2024/11/13
21:21 UTC

5

Safari Extension rejected for using "for [Platform]" in name - despite many precedents

App Review Question: Using "Reddit" in App Name/Subtitle

Hi dev community,

I've run into an interesting situation with App Review that I'd like to get the community's perspective on.

My Safari extension "Protego for Reddit" (a content filter for Reddit) was rejected under Guidelines 2.3.7 for using "Reddit" in the name/subtitle, citing potential customer confusion.

Current Precedents

What's puzzling is there are many established apps using the same naming pattern for the app name and subtitle, all currently on the App Store:

  • Narwhal 2 for Reddit - "Highly customizable Reddit app"
  • Sink It for Reddit - "Upgrade Your Reddit Experience"
  • Reno for Reddit - "instagram styled Reddit app"
  • Dystopia for Reddit - "A Better Way to Reddit"
  • MultiTab for Reddit - "Best viewer for image/video"
  • Nano for Reddit - "The wrist-based Reddit client"
  • Focus for Reddit - "A unofficial app for Reddit"
  • Monocle for Reddit - "A comprehensive Reddit client"
  • Redirect for Reddit - "Redirects to old.Reddit.com!"
  • Alerts for Reddit - "News"
  • rex for Reddit - "Lurk with ease!"
  • Comet for Reddit - "Fast, Robust, and Beautiful"
  • Redista client for Reddit - "Entertainment"
  • Readder for Reddit - "Entertainment"
  • lurkur for Reddit - "a new way to browse"
  • Pics HD for Reddit - "Entertainment"
  • Apollo for Reddit - "Closed. Goodbye and thank you!"
  • and more

Current Situation

I submitted a reply to the app review rejection and they told me that if I disagree with the outcome of their review that I need to file appeal to the App Review Board.

I've already submitted an appeal pointing out these precedents and explaining that the name accurately describes the app's functionality without implying any official association. While I wait for the response, I'm curious about a few things:

Questions for the Community

For those who maintain apps with "for [Platform]" in the name:

  1. Do you face this rejection with every update?
  2. Did you only have to appeal once, after which subsequent updates were approved?
  3. Was there any special process to get your app "whitelisted" for this naming convention?
  4. Has anyone noticed if this is a recent change in enforcement? The number of existing apps with similar names suggests this wasn't always strictly enforced.

For those who successfully appealed similar rejections:

  1. How long did the appeal process take?
  2. Did you need to escalate beyond the initial appeal?

My concern is whether I'll need to go through this rejection/appeal cycle with every update, which would significantly impact our ability to push out timely fixes and improvements. I've had to delay two updates due to this issue.

Context

  • App description: Safari extension for filtering Reddit content on Mac
  • Current name: "Protego for Reddit"
  • Subtitle: "Filter your Reddit Feed"
  • Version: 1.3
  • Status: Awaiting appeal response

Many of these established apps even use "Reddit" in their subtitles, which makes the rejection of my subtitle "Filter your Reddit Feed" particularly confusing.

Thanks in advance for any guidance or shared experiences!

2 Comments
2024/11/13
20:24 UTC

2

Looking for some help

Hello everybody,

Around a year ago I took a course to learn Swift and continue learning for myself. Since I have a non-programing career and my job was very busy, I stopped my learning process. Now my company change my role to a more relaxing position, I returned back to my learning process.

First thing I notice is that I lack practice. Can someone recommend me a few projects from simple to advance?

Please note that, after I had some self confidence, I want to find a remote a part time work or internship this my main goal.

1 Comment
2024/11/13
18:30 UTC

2

Help please! Best approach for updating subscriptions in my app?

I have a question about handling subscription changes for my already released iOS app. The app currently has a single subscription group with two plans: monthly and yearly. Currently, subscriptions allow users to view their UV Exposure data from the past 10 days while subscribed. The new version of my app will allow users to see all of their historical UV Exposure data (not just the last 10 days) while they are subscribed. I am not sure how I should approach this change.

My first idea is to modify the subscription description to indicate that it now includes access to all historical data. For example, change the current description from "See past 10 days of UV scores for 1 year" to "See all historical UV scores for 1 year". I'm concerned that changing the description might not pass the review. It could be seen as a 'modification' that impacts existing users, potentially causing confusion even though the modification strictly adds new functionality as an upgrade. Is this a valid concern?

Do I need to create new subscriptions for the "unlimited" access and somehow migrate existing users? Or should I create a new subscription group? I'm lost at how to proceed here. Can someone point me in the right direction? Any help would be greatly appreciated!

2 Comments
2024/11/13
17:12 UTC

0

Replace MWPhotoBrowser with modern alternative

I have an iPad app, written in objective-c and distributed through Enterprise developer, as it is not for public use but specific to some large companies.

The app has a local database and works offline

For some functions of the app I need to display images (not edit or cut them, just display them)

Right now there is integrated MWPhotoBrowser viewer, which has not been maintained for almost 10 years, so in addition to warnings in compilation I have to fight with some historical bugs especially on high resolution images. https://github.com/mwaterfall/MWPhotoBrowser

Do you know of a modern and maintained OFFLINE photo viewer? I evaluate both free and paid (maybe an SDK). My needs are very basic

I have found this one https://github.com/TimOliver/TOCropViewController, but I need to disable the photos edit features and especially I would lose the useful feature of displaying multiple images (mwphoto for multiple images showed a gallery)

0 Comments
2024/11/13
16:27 UTC

1

NSPersistentCloudKitContainer not saving 50% of the time

I'm using NSPersistentCloudKitContainer to save, edit, and delete items, but it only works half of the time. The operations are simple enough:

moc.delete(thing)
try? moc.save()

When I delete an item and terminate the app and reopen, sometimes the item is still there and sometimes it isn't.

Here is my DataController. I'm happy to provide more info as needed

class DataController: ObservableObject {
    let container: NSPersistentCloudKitContainer
    @Published var moc: NSManagedObjectContext
    
    init() {
        container = NSPersistentCloudKitContainer(name: "AppName")
        
        container.loadPersistentStores { description, error in
            if let error = error {
                print("Core Data failed to load: \(error.localizedDescription)")
            }
        }
        
        #if DEBUG
        do {
            try container.initializeCloudKitSchema(options: [])
        } catch {
            print("Error initializing CloudKit schema: \(error.localizedDescription)")
        }
        #endif
        
        moc = container.viewContext
    }
}
4 Comments
2024/11/13
16:16 UTC

Back To Top