/r/iOSProgramming
A subreddit to discuss, share articles, code samples, open source projects and anything else related to iOS, macOS, watchOS, tvOS, or visionOS development.
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:
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
Hey guys, so I've really been pulling my hair out over this one for over two days now and wanted to see if anyone had some insight. I've been working on this app as a way to familiarize myself with SwiftData. I am trying to add a SwiftData Model to as a property to another Model that I first get through a .fetch request, but I constantly get the following error:
Thread 1: "Unacceptable type of value in to-many relationship: property = \"associatedExerciseTemplates\"; problem = {(\n <NSManagedObject: 0x60000233a1c0> (entity: ExerciseTemplate; id: 0x60000034d400 <x-coredata:///ExerciseTemplate/tEE67E00E-734A-4B12-97A8-A30A2CBDE255322>; data: {\n createdAt = \"2024-11-03 21:16:45 +0000\";\n id = \"2168A295-4A58-4E95-8E7A-5B65B8EE736C\";\n index = nil;\n movement = nil;\n notes = \"\";\n sets = (\n );\n workout = nil;\n})\n)}; desired type = NSManagedObject; given type = __NSSetM; value = <NSManagedObject: 0x60000233a1c0> (entity: ExerciseTemplate; id: 0x60000034d400 <x-coredata:///ExerciseTemplate/tEE67E00E-734A-4B12-97A8-A30A2CBDE255322>; data: {\n createdAt = \"2024-11-03 21:16:45 +0000\";\n id = \"2168A295-4A58-4E95-8E7A-5B65B8EE736C\";\n index = nil;\n movement = nil;\n notes = \"\";\n sets = (\n );\n workout = nil;\n})."
The relevant code snippet is below, and the crash reliably happens when assigning mainMovement to newExercise.movement. They are definitely in the same modelContext as the print statement is returning true.
Note this last line is where the issues happen. I don't think there is an issue with the relationship models as if I create a new Movement model here (newMovement = Movement() for instance), then insert it into the context and assign it to new exercise (newExercise.movement = newMovement) it works just fine. I also made a post in r/SwiftUI and some people seemed to think that the issue may stem from my use of 'id' as a property and that this was messing with SwiftData's persistent storage system, but I don't think this is the case because SwiftData models have a baked in persistentModelID property for this. I've attached the relevant data models below.
tldr; trying to use an existing SwiftData model as a property in a new one causes fatal error. Why?
I started using ChatGPT for free last year. It has become an addiction. I use it every day at work and for pretty much everything. I had enough of its limitations so I went premium. It works, well at least around 90% of the time. For example, I wanted to convert a massive Objective-C controller to Swift - all I had to do was correct some syntaxes.
When my ChatGPT subscription expired, I realized Claude was so much better. Research comparing their models shows that Claude is better, so I went premium again.
Anyway, I came here with a throwaway account to share how I feel, that I am becoming more incompetent in programming as I grow older and older, and how I become more dependent on AIs. I don't care. I have the programming basics, I have almost 10 years of experience, I can teach my kids coding soon, I earn a significant amount of money to call myself rich (I have reached the wealthy income bracket, maybe because I have 3 jobs), and more importantly, I am having less stress whenever I have a very complex ticket - all because of AI. I don't plan to forever be dependent on employment as a programmer, I mean, well, even if I retire, I will still code, but if ever we all lose jobs (at least the front-end coders), I will be ready.
I apologize if this is all bragging. I am just expressing my gratitude to AIs. I remember being so stressed in my past job(s) whenever I had a difficult task. I don't want to be on that spot again. Thank you, AI.
Hello, this is the code I'm using. I'm testing the delivery of local notifications on my app in TestFlight on my iPhone 11 Pro Max, by setting my date and time to a minute before the scheduled delivery. If the code runs on day 0, reliably the notifications on day 1 and 2 are not received but the notification on day 3 is. As a result I am currently using code which only sends notifications on day 3, 4 and 5 and these all are sent successfully. Been tearing my hair out trying to figure this out, please help :( Many thanks!
Future<void> schedulePushes(List<dynamic> notificationsContent) async {
if (notificationsContent == null || notificationsContent.isEmpty) return;
final FlutterLocalNotificationsPlugin notifications =
FlutterLocalNotificationsPlugin();
// Initialize timezone data
tz.initializeTimeZones();
final initializationSettings = InitializationSettings(
iOS: DarwinInitializationSettings(
requestAlertPermission: true,
requestBadgePermission: true,
requestSoundPermission: true,
),
android: AndroidInitializationSettings('@mipmap/ic_launcher'),
);
await notifications.initialize(initializationSettings);
// Clear existing notifications
await notifications.cancelAll();
final notificationDetails = NotificationDetails(
iOS: DarwinNotificationDetails(
presentAlert: true,
presentBadge: true,
presentSound: true,
sound: 'default',
importance: Importance.high,
),
android: AndroidNotificationDetails(
'daily_notifications',
'Daily Notifications',
channelDescription: 'Anti-anxiety app daily notifications',
importance: Importance.max,
priority: Priority.high,
),
);
// Get current time
final now = tz.TZDateTime.now(tz.local);
// Schedule for days 1, 2, and 3
for (int i = 0; i < notificationsContent.length && i < 3; i++) {
final scheduledDate = tz.TZDateTime(
tz.local,
now.year,
now.month,
now.day
+ (i + 1), // Schedule for next three days (1, 2, 3)
10, // 10 AM
0,
);
await notifications.zonedSchedule(
i + 1, // Simple sequential IDs (1, 2, 3)
notificationsContent[i]['title'] ?? 'Your daily Reset',
notificationsContent[i]['body'] ?? '',
scheduledDate,
notificationDetails,
androidAllowWhileIdle: true,
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime,
);
// Keep the delay between scheduling
await Future.delayed(Duration(milliseconds: 500));
}
}
As title says, looking for a short introduction (videos or articles) to the composable architecture. Every time I google it I end up back here https://www.pointfree.co/collections/composable-architecture on point free’s site where it’s a daunting 58 hours of videos to learn about it.
I know it’s a different paradigm to the likes of MVVM or VIPER, and more follows redux patterns of React, but 58 hours feels excessive.
I have an app which is dependent on having a backend connection. It's built with a local-first approach so it can run OK even with airplane mode, but the idea is that it doesn't make sense to run it without ever connecting to the internet.
Since I'm actively developing the app, I am updating the APIs from time to time. I aim to keep backwards compatibility with a few previous published app versions, but at some point in time I don't see the benefit of supporting older apps that weren't updated for months.
Can anyone share what your experience with a similar use case was? Do you display some warning to users who haven't updated their apps? Is there a way to check how many users use older versions?
What’s different between “objc extension” and “extension”?
The app i am working on currently has functionality to pay your bill. To do so requires you to be logged in first, and the authentication token expires after 10 minutes unless renewed.
Id like to create an intent to allow a user to see their bill and payment details and have a dialog to pay that.
similar to the starbucks example from wwdc
I understand the basic flow enough to get the app intent dialog to show a cancel or pay button along with a snippet view. My question is surrounding authentication. What if the app hasnt been recently used? What is the best practice? Am i able to prompt for login or do biometrics to fetch their login details to login before fetching the necessary details to fill in this screen?
Hi everyone! I've received a request from the client to install Facebook's SDK to use the SKAdNetwork API.
However, I'm getting an error saying "Your app is out of date. To run your app on iOS 14." Has anyone solved this issue? I've searched, and there are people experiencing similar issues, but I can't find any posts about how they actually solved it. The image is attached below.
Happy to announce the release of my new iPhone/iPad AR game: RealMaze AR! #realmazear
Walk inside a life-sized maze and solve challenging mazes as fast as you can. Some levels have cool lighting effects. There are 4 power-ups you can use to help you solve the maze faster.
App Store link: https://apps.apple.com/us/app/realmaze-ar/id6477399380
Web site: https://www.syncopa.net
Press kit including full game description: https://www.syncopa.net/press-kit
I did everything on my own, including game design, coding, art, and music.
I'd love to hear your feedback. What do you think about this game?
So far I barely get any downloads, any idea why?
Is it because this game requires the player to stand up and move?
Is there something missing or wrong?
Or do I just need to promote it more?
Thanks! Your feedback will be very much appreciated!
Hiya, everyone!
This week I released the beta test of my upcoming app and I'm looking for users to test it. I actually released it a month and a half ago, but it was buggy as hell and I took all this time to redo the app, migrate from SwiftData to CoreData and also test each functionality individually.
What's the app about? It's a tool for freelancers that want to create and send quotes to their clients easily, as well as keep track of the status of each individual quote (to be sent, sent, approved or cancelled), and have a list of all of their clients in one single place. Some upcoming features I want to bring to the app is the generation of invoices and also an income/expenses balance track.
Please HMU on DM with your mail address if you'd like to be invited to the beta.
Thanks a lot!
Short Version: Is it possible for an iPhone app to attempt to connect to a website via Safari in the background with no guidance from a user? Would it show up on the App Privacy Report as Safari that's trying to connect or the other app?
Longer Version: My friend and I have found out recently that their iPhone is attempting to connect to an HTTP URL in the background. The URL itself is for a domain owned by someone who also has an iPhone App but for a separate organization. There's no official connection between the organization for the domain and the app, but obviously it seems likely the app is what is trying to connect to this URL. The reason why we noticed it, is because the home wifi network will block the connection as insecure and it shows that it is indeed this iPhone in particular that repeatedly tries to connect.
We set up App Privacy Report today, and it only shows Safari as what is trying to go to the URL. The app in question had no observable activity. They don't ever use the app itself, it's something that was installed a long time ago and then never really used. The app has been deleted from the phone, but I'm still curious whether it's possible
I'm a developer, but not for iPhone, and I only have very little experience with Android from years ago when I was in school. So apps and app permissions/capabilities aren't really something I know much about. I've tried searching for app permissions and making requests through Safari but could really only find people having issues with how links are opened on their iPhone. So I'm hoping that someone here can help us narrow down what could be causing this behavior.
The other day, I came across this post from Sam Altman:
https://x.com/sama/status/1845499416330821890
Hi said "Love this" in response to a user who suggested asking ChatGPT, “From all of our interactions, what is one thing you can tell me about myself that I may not know about myself?”
If you found ChatGPT’s memory feature interesting, you might want to try our app, MyReflection.ai. Compared to ChatGPT’s memory, MyReflection’s memory feature is on another level. It uses three different types of memory to develop a deep understanding of you: short-term memory, long-term memory, and in-context memory. The more you interact with the chatbot, the better it gets to know you, eventually responding to similar questions with incredibly detailed answers that offer real insights into your mind, thoughts, and feelings.
While ChatGPT is designed to be an assistant, MyReflection feels more like a wise friend who’s always there to help you reflect and revisit your memories. You can upload images, record your voice, or have a simple conversation with it. After each session, it even provides a journal-like summary that captures the essence of the conversation, which you can always refer back to.
Give MyReflection.ai a try and let us know your feedback—it’s completely free for now!
I'm working on a multiplatform app and the iOS versions works fine both in Xcode and in the export, but my macOS app gives a "App cannot be opened" error when opening the .app that the .pkg file (from Xcode Cloud) gives. Has anyone encountered this before? This is very weird since it works fine through Xcode (even when the build scheme is set to RELEASE)
I even tried creating a new project and moving all the files and settings but it still doesnt work!!
Help is very much appreciated 😭
Hi, I use some localisations on the appstore for improving ASO in the USA. And I want to know which one of my localisations drive impressions and downloads.
Appstore analytics allow to breakdown based on referrers, custom product pages, in-app events and more, but I can't find localisations anywhere...
Do you know if it's possible to see this metrics?
Thanks!
I ported one of my favorite games to iOS, also added leaderboards
https://apps.apple.com/us/app/candy-train-classic/id6587559761
Any thoughts on performance and experience Previewing SwiftUI views directly on device? Is it faster than in Xcode? Also use MacOS Sequoia you can now turn on iPhone Mirroring and see your iPhone screen on your Mac. This is great when you have your phone in another room. Has anyone tried this setup?
Hello,
I need to develop iOS app, but I don't own any of apple devices. Is there any options to rent macos virtual machine at AWS or Azure which works fine enough to develop and test iOS app?
I tried to setup my own local macos VM using KVM, but it was so slow and buggy that it's impossible to do anything inside of it.
I have a premium/paid app since 4 year with about 100k users. Many copycats have made a copy of my app free with a subscription model. I have to follow since they steal my new users.
Ideas on how to first of all identify the old users (don't have a login) or how to treat them? Must they subscribe for the features they today have "already paid for"
Thoughts? And have anyone done this transission?
Here it is, my new app Kids Learn Sounds
Unlock the joy of sound exploration with over 120 unique, high-quality audio experiences across three exciting categories: Animals, Instruments, and Nature. Perfect for sparking curiosity in children, this app allows them to tap on objects and hear their distinct sounds—whether it’s the roar of a lion, the strum of a guitar, or the sound of rainfall.
Highlights:
-Explore 3 captivating categories: Animals, Instruments, and Nature
-Enjoy over 120 interactive sounds
-Supports 10+ languages for a global learning experience
-Intuitive interface designed for children of all ages
-Vibrant visuals and clear, high-quality audio
-A wonderful way to engage, entertain, and inspire children through sound!
We all started with those “free trial” offers, but then the unexpected charges start showing up on our credit card statements, right? That’s where Subscription Budget Tracker comes in! 🎉
With this app, you can keep track of what you’re spending on each service and manage your monthly budget more effectively. Whether it’s digital media subscriptions or food delivery services, you can monitor all your expenses in one place.
Key Features:
• 💸 Easily add and edit subscriptions
• 📅 Get reminders for payment dates so you can avoid last-minute surprises
• 📊 Review your monthly spending to identify any unnecessary expenses
Now, it’s easier than ever to see where your money is going! If you’re ready to take control of your subscriptions, give our app a try! 👇
Hi everyone! I'm currently building a SwiftUI app and need to integrate a calendar where counselor can schedule events. I've tried using the Google Calendar API but ran into some challenges with the setup and gave up on Google.
Are there any other calendar APIs that you recommend for SwiftUI integration? Ideally, I'd like a solution that's user-friendly and doesn’t require extensive backend work. Any advice or resources would be greatly appreciated! Thanks in advance!
In short, my consultants will easily select their available days and hours from an easy interface (like Google Calendar weekly view), and I will display this as availability status to users in the app.