Delve into the world of built-in app and system services available to developers. Discuss leveraging these services to enhance your app's functionality and user experience.

Post

Replies

Boosts

Views

Activity

How can I pause iOS Shortcut automation programmatically
I want to "pause" an Intent ( iOS Shortcut Automation ) how can I achieve it? Basically we have a small task to execute, whenever we setup an automation for one app, lets say LinkedIn, our app runs and asks the user whether they still want to continue with LinkedIn or whether they don't want to. The automation to open our app when LinkedIn is opened is working fine. What we want to achieve is that once a user taps on "Continue to LinkedIn" it should "pause" the automation this time and open LinkedIn instead of opening our app again.
0
0
687
Dec ’23
How to get PDF file in Safari with PDF options mode( or Reader PDFoptions mode) for our app extension?
Hi, Currently, our app extension needs to get PDF file( Safari generates itself from the url) with Reader PDF options mode( or PDF options mode). So, How to get PDF file in Safari with Reader PDF options mode( or PDF options mode) for our app extension? Is there any need to declare anything special in the Info.plist file of the extension? Does the Safari extension support exporting these PDF files? Or only used for OS default apps? Thanks.
0
0
481
Dec ’23
Apple Developer account status still PENDING from 28 November 2023
I'm applying for Apple Developer Account and my Enrollment ID is 5HDTV3J32F, I have completed the payment since 28 November 2023, but until today the status is still pending, please help to fix my issue, because my company asking me to upload the iOS Version of our company application, Below is the email when I finished the payment process from 28 November 2023 It's already taken too long from 28 November until today, Apple Developer team please respond and handle my issue! Regards
0
0
360
Dec ’23
Apple Developer account status still Pending from 28 November 2023
Hi Apple Developer Team, I'm applying for Apple Developer Account and my Enrollment ID is 5HDTV3J32F, I have completed the payment since 28 November 2023 and the status is still pending until now, please help to fix my issue, because my company asking me to upload the iOS Version of our company application, This is the screenshot I'm completing my payments in 28 November 2023 Please help to solve and fix my problem Apple Developer team!
2
0
462
Dec ’23
Calling an URSession task in background and display local notification
I would like to call a "GetMessages" API every 10 minutes while the app is not active or shutdown. if a message is returned, display the message as a local notification Will the background api run if the app is shut down? An example of this is when an email app shows a notification. Can they pull from their server while the app is not running or do they use the push notification service. I know that calendar events can be scheduled locally and for location changes, but I don't know if calling a api task with the app not running is possible.
1
0
639
Dec ’23
Sign in with apple not returing "user" info although scopes are requested
I am attempting to use sign in with apple id based on the documentation at https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/incorporating_sign_in_with_apple_into_other_platforms My authorization url ishttps://appleid.apple.com/auth/authorize?client_id=REDACTED&redirect_uri=REDACTED&response_type=code&response_mode=form_post&scope=name%20email The response data does not contain the documented "user".. The post data contains only "state" and "code" params. Is there something else which must be done with the authorization url? Is there something which must be configured for the app?
1
0
397
Dec ’23
Write Only permission not working with provided snippet
Hi, I am evaluating the write ony mode and on my Development iPhone (14 Max Pro / 17.2) I get an error when trying to add an event in write only access mode. I am using the provided snippet let store = EKEventStore() // Request write-only access guard try await store.requestWriteOnlyAccessToEvents() else { return } // Create an event let event = EKEvent(eventStore: store) event.calendar = store.defaultCalendarForNewEvents event.title = "WWDC23 Keynote" event.startDate = myEventStartDate event.endDate = myEventEndDate event.timeZone = TimeZone(identifier: "America/Los_Angeles") event.location = "1 Apple Park Way, Cupertino, CA, United States" event.notes = "Kick off an exhilarating week of technology and community." // Save the event guard try eventStore.save(event, span: .thisEvent) else { return } On the .save step I receive the following Error ("The calendar is read only") Failed to save event: Error Domain=EKErrorDomain Code=6 "Der Kalender ist schreibgeschützt." UserInfo={NSLocalizedDescription=Der Kalender ist schreibgeschützt.} Changing the premission to Full Access makes the snippet work. I tested with iCloud and CalDav Accounts. Both fail. Does anyone have similiar problems? Or a solution to this? It seems like a bug to me.
1
2
762
Dec ’23
In Swift, how can I get the "last Sunday of a month before the current date"?
I want to find the "last Sunday of a month before the current date" in Swift, but using the Calendar nextDate function doesn't work (always returns nil). var calendar: Calendar = Calendar(identifier: .gregorian) calendar.timeZone = .gmt let lastSundayDateComponents: DateComponents = DateComponents( weekday: 1, weekdayOrdinal: -1 ) let previousLastSundayDate: Date? = calendar.nextDate( after: Date.now, matching: lastSundayDateComponents, matchingPolicy: .nextTime, repeatedTimePolicy: .first, direction: .backward ) print(previousLastSundayDate ?? "Not found") // "Not found" If I use a positive weekdayOrdinal, it's working normally and the same nextDate method provides the correct date. let firstSundayDateComponents: DateComponents = DateComponents( weekday: 1, weekdayOrdinal: 1 ) When I check if the date components can provide a valid date for the given calendar, it returns false... let lastSundayInNovember2023DateComponents: DateComponents = DateComponents( year: 2023, month: 11, weekday: 1, weekdayOrdinal: -1 ) // THIS RETURNS FALSE let isValid: Bool = lastSundayInNovember2023DateComponents.isValidDate(in: calendar) print(isValid) // false ... even if the correct date can be created. let lastSundayInNovember2023: Date = calendar.date(from: lastSundayInNovember2023DateComponents)! print(lastSundayInNovember2023) // 2023-11-26 00:00:00 +0000 Is that a bug in Foundation?
2
0
820
Dec ’23
No Observable Object of type...found
I am learning SwiftUI. Error: SwiftUI/Environment+Objects.swift:32: Fatal error: No Observable object of type ViewModel found. A View.environmentObject(_:) for ViewModel may be missing as an ancestor of this view. I do not get the point why this happens. The error is shown in the line : "renderer.render {... import SwiftData import SwiftUI @Observable class ViewModel { var groupNumber: String = "Gruppe" var sumOfHours: Int = 0 var personsToPrint: [Person]? = nil @MainActor func pdfReport(person: [Person]) { if personsToPrint != nil { for person in personsToPrint! { let renderer = ImageRenderer(content: PersonDetailView(person: person)) let url = URL.documentsDirectory.appending(path: "\(person.lastname) \(person.firstname).pdf") print(person.lastname, person.firstname) renderer.render { size, context in var box = CGRect(x: 0, y: 0, width: size.width, height: size.height) guard let pdf = CGContext(url as CFURL, mediaBox: &box, nil) else { return } pdf.beginPDFPage(nil) context(pdf) pdf.endPDFPage() pdf.closePDF() let data = try! Data(contentsOf: url) //pdf muss erst in Daten umgewandelt werden. do { try data.write(to: url) print("Daten wurden hier gespeichert: \(url)") } catch { print("PDF could not be saved!") } } } } } }
1
0
793
Dec ’23
WidgetKit works in Simulator but not on device
I can't get the simplest Widget to work. I simply want to present the app's icon. It does what it's supposed to do in the simulator but on the actual device it only says "Please adopt containerBackground API" at the place where the Widget would have shown otherwise. I found out that I am supposed to add .containerBackground(Color.clear, for: .widget) for no reason at all to make this work. However, when I do that, I just get a gray circle where the app icon was supposed to show. The png files should be fine because again on the simulator it works so I have no idea what I am doing wrong. If someone can tell me what I'm doing wrong or if someone can share their Widget class that would be awesome - I literally only want to show my app's icon on the Watch face but I already fail at that, no idea why they made WidgetKit impossible to work with. import SwiftUI import WidgetKit struct IconEntry: TimelineEntry { let date = Date() let icon: Image } struct IconProvider: TimelineProvider { func placeholder(in context: Context) -> IconEntry { return IconEntry(icon: getImageForContext(context, color: false)) } func getSnapshot(in context: Context, completion: @escaping (IconEntry) -> ()) { let entry = IconEntry(icon: getImageForContext(context, color: false)) completion(entry) } func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) { let entry = IconEntry(icon: getImageForContext(context, color: false)) let timeline = Timeline(entries: [entry], policy: .never) completion(timeline) } } struct IconWidget: Widget { let kind: String = "IconWidget" var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provider: IconProvider()) { entry in IconView() .containerBackground(Color.clear, for: .widget) } .supportedFamilies([.accessoryCircular, .accessoryCorner, .accessoryRectangular]) .description(Text("Show the app's icon on a watch face.")) } } struct InlineWidget: Widget { var body: some WidgetConfiguration { StaticConfiguration(kind: "Inline", provider: IconProvider()) { entry in Text("App Title") .containerBackground(Color.clear, for: .widget) } .configurationDisplayName("App Title") .description("Description") .supportedFamilies([.accessoryInline]) } } func getImageForContext(_ context: TimelineProviderContext, color: Bool) -> Image { var fileNameToUse = "iconColor.png" if(!color) { fileNameToUse = "iconAlpha.png" } let displaySize = context.displaySize if(displaySize.width == 0 || displaySize.height == 0) { return Image(uiImage: .init()) } let uiImage = UIImage(imageLiteralResourceName: fileNameToUse).resizeImage(width: displaySize.width, height: displaySize.height) let image = Image(uiImage: uiImage) return image } struct IconView: View { @Environment(\.widgetRenderingMode) var widgetRenderingMode var body: some View { imageFor(widgetRenderingMode) .resizable() .onAppear { print("ICON VIEW \(widgetRenderingMode == .fullColor ? "COLOR" : "ALPHA")") } .containerBackground(Color.clear, for: .widget) } } private func imageFor(_ widgetRenderingMode: WidgetRenderingMode) -> Image { switch widgetRenderingMode { case .fullColor: return Image(uiImage: UIImage(imageLiteralResourceName: "iconColor.png")) default: return Image(uiImage: UIImage(imageLiteralResourceName: "iconAlpha.png")) } } @main struct IconBundle: WidgetBundle { @WidgetBundleBuilder var body: some Widget { IconWidget() InlineWidget() } } extension UIImage { func resizeImage(width: CGFloat, height: CGFloat) -> UIImage { let edgeLength = min(width, height) let newSize = CGSize(width: edgeLength, height: edgeLength) UIGraphicsBeginImageContextWithOptions(newSize, false, 0.0) self.draw(in: CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height)) if let resizedImage = UIGraphicsGetImageFromCurrentImageContext() { UIGraphicsEndImageContext() return resizedImage } else { return UIImage() } } }
2
0
1.1k
Dec ’23
Ads at VisionOS
Hi all, I'm new to Apple Ads Guides, my excuses if topic has been discussed or I missed it in Policies documentation, please give a link if so. Would like to know more about VisionOS and in-app rules for it. Are there any limitations for integration a code of ad networks or non related to app sponsored content into the applications there? What are the options for additional monetization of apps for AR/MR/VR?
1
0
970
Dec ’23
AuthorizationCenter.shared times out and makes my ScreenTime App Unusable
Any way that I try requesting authorization for family controls is incredibly inconsistent. The line of code that hangs is **let center = AuthorizationCenter.shared ** I've looked at other posts and I saw someone recommended declaring let center = AuthorizationCenter.shared outside the main thread and somehow get the status on the main thread. I've tried that approach with no success. I've scoured GitHub to see how other people approach the request but it's all pretty similar. The following code sometimes works great for a few minutes and then I rebuild and run and it hangs on AuthorizationCenter.shared.requestAuthorization(for: FamilyControlsMember.individual). Would love any suggestions!!! .onAppear { Task { do { print("try requestAuthorization") try await AuthorizationCenter.shared.requestAuthorization(for: FamilyControlsMember.individual) print("requestAuthorization success") switch AuthorizationCenter.shared.authorizationStatus { case .notDetermined: print("not determined") case .denied: print("denied") case .approved: print("approved") @unknown default: break } } catch { print("Error requestAuthorization: ", error) } } }
0
0
643
Dec ’23
Ads Attribution with Firebase without IDFA consent
Hi everyone, I'm using the Firebase SDK in my app, and I'm planning to monitor ad attribution. The primary reason is to determine how many sales are generated from ads. After exploring ad attribution, I see two options: Use Firebase for ad attribution – this appears to be the quickest and easiest method. Implement it myself and send the data to my server. However, I don't want to ask users for IDFA consent. All I need is the standard payload response, and I understand that I don't need consent for that data. Managing this data with my server is more of a hassle compared to using Firebase. So, is there a way to use Firebase without asking for consent? Just to retrieve the standard data that doesn't require consent anyway. Thank you for your help!
1
0
832
Dec ’23
Calendar nextDate/enumerateDates methods with backward direction does not work for September
I’m trying to get the previous date that matches the 9nth month in the Gregorian calendar (which is September) from Date.now (which is in December 2023 right now). The expected date is then in 2023. The first date returned is in 1995. Why? I filed the feedback FB13462533 var calendar: Calendar = Calendar(identifier: .gregorian) calendar.timeZone = TimeZone.autoupdatingCurrent let matchingDateComponents: DateComponents = DateComponents(month: 09) let date: Date? = calendar.nextDate( after: Date.now, matching: matchingDateComponents, matchingPolicy: .nextTime, direction: .backward ) print(date) // Optional(1995-08-31 23:00:00 +0000)
4
0
584
Dec ’23
Apple app site association CDN cache only working in Europe.
We have our apple-app-site-association file hosted on our website. It passes AASO verification, we can pull it successful as application/json via curl, and it also shows up as expected with a https://app-site-association.cdn-apple.com/a/v1/ourdomain.com link - however only in Europe. The apple CDN link works in: Czech, Finland, UK, and Spain, however it does not work in U.S., Phillipines, or Canada. In those cases, the CDN page shows "not found". It's quite strange that it only works in Europe. The file we are hosting doesn't have any IP restrictions that we are aware of, and we can access the file URL hosted on our website directly from the U.S. and Canada. So it seems that only Apple's CDN cache is failing to retrieve/store it for some reason, in certain locations. Has anyone seen something like this?
1
0
580
Dec ’23
MFMessageComposeViewController not generating link preview if message body is not edited
I am using MFMessageComposeViewController with pre-filled recipients and message. This message ends with a unique URL, e.g.: I made a card for you! https://my.domain.com/unique-card-url The user can edit this message, of course, but if the message is not modified then the link preview is not generated. (Subsequent messages with the same link are generated.) When sending same message (each time with a new unique url) in iMessage the link previews are generated properly. This appears to be an edge case when pre-populating the message body. Because the body is never edited in the MFMessageComposeViewController itself, it never generates the link preview before sending.
1
0
440
Dec ’23