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

WeatherKit REST API parameter validation inconsistency
The status codes returned for REST API queries give a good indication of the issue encountered. Generally: 200 is good 400 means you've passed in bad or incomplete parameters 401 is an authentication issue However, there's a parameter validation inconsistency on the availability endpoint. If you pass in out-of-range coordinates to the weather endpoint, you get the expected 400 response code. But if you pass bad coordinates to the availability endpoint, it blows up and returns a 500 (internal server error). I've got code that can deal with this response, but it would be much better to know exactly where the problem lies. 500 tells me there's an issue on the server that's out of my control...
1
0
481
Nov ’23
Build RichTextEditor with Native Apple Framework
Hi, I new in the Apple Development world using Apple Frameworks. I already got familiar with SwiftUI and I can handle the Swift programming language. However, I need some guidance about what approach I should take to develop a Rich Text Editor for a personal App. I am working on. I could build the Editor using any HTML & any JS Editor Framework like EditorJS. But I prefer to take the native Apple approach, if there is one framework that I can easily use to implement the following capabilities: Text Styling -. Present a paragraph, titles, and subtitle headers with a predefined font size and styles. -. Bulleted and numbered lists Indenting and out-denting of text Formatting -. Predefined Bold, italic, underline, code, strikethrough, sub- and super-scripting Embedding -. Images --> Framework ? -. Iframes --> Framework ? -. Videos --> Framework ? -. Audio --> Framework ? -. Tables and Predefined tables --> Framework ? -. Links -. Drawing canvas with Ipad Pencil --> PencilKit -. PDF view and reviews. --> pdfKit. -. Math formulas. --> Framework ? -. Diagram and flow chart editing --> Framework ? Any recommendation about what framework to use will be appreciated. Thanks in advance.
1
0
943
Nov ’23
Retrieving user's chosen name in Sign In with Apple
Hi, I'm developing an app that supports sign-in with Apple. From the documentation, it seems that the name provided during registration with Apple Sign In isn't saved by Apple and isn't accessible later on. However, in the event of a server issue during registration, how should I manage the flow? In my opinion, it should be possible to retrieve the chosen name later or programmatically cancel the association of the user's Apple ID from the app to restart the registration process. What are your thoughts?
1
0
455
Dec ’23
SFSafariViewController behaves differently in MacCatalyst than iOS
I was loading a URL using SFSafariViewController in my app and also implemented the SFSafariViewControllerDelegate. I noticed that when I am running my app on iOS, I am not getting the callBack in safariViewControllerDidFinish(_:) until or unless "Done" button is pressed. But when I am running it on MacCatalyst following behaviour is noticed: default browser is launched. I get a callback in safariViewControllerDidFinish(_:) without any of my action(like pressing "Done" button). Is this the expected behaviour? I am curious to know why I am getting callback in safariViewControllerDidFinish(_:).
1
0
688
Dec ’23
A random crash on DateFormatter
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libicucore.A.dylib 0x18c500918 icu::SimpleDateFormat::subFormat(icu::UnicodeString&, char16_t, int, UDisplayContext, int, char16_t, icu::FieldPositionHandler&, icu::Calendar&, UErrorCode&) const + 532 1 libicucore.A.dylib 0x18c500520 icu::SimpleDateFormat::format(icu::Calendar&, icu::UnicodeString&, icu::FieldPositionHandler&, UErrorCode&) const + 520 2 libicucore.A.dylib 0x18c5002f8 icu::SimpleDateFormat::format(icu::Calendar&, icu::UnicodeString&, icu::FieldPosition&) const + 84 3 libicucore.A.dylib 0x18c42c4ac icu::DateFormat::format(double, icu::UnicodeString&, icu::FieldPosition&) const + 176 4 libicucore.A.dylib 0x18c535c40 udat_format + 352 5 CoreFoundation 0x189349a14 __cficu_udat_format + 68 6 CoreFoundation 0x189349898 CFDateFormatterCreateStringWithAbsoluteTime + 192 7 Foundation 0x18a432bf0 -[NSDateFormatter stringForObjectValue:] + 316 8 ShiningUtiliesKit 0x10522a130 SULog.log(:logDegree:file:method:line:) + 488 9 ShiningUtiliesKit 0x105229f3c SULog.debug(:file:method:line:) + 48 10 Calibration 0x1029f56bc closure #1 in Device.setDeviceData(:) + 487 (DeviceObject.swift:293) 11 Calibration 0x1029f3de0 specialized autoreleasepool(invoking:) + 23 (:0) [inlined] 12 Calibration 0x1029f3de0 Device.setDeviceData(_:) + 23 (DeviceObject.swift:291) [inlined] 13 Calibration 0x1029f3de0 closure #1 in closure #1 in variable initialization expression of Device.callback + 403 (DeviceObject.swift:221) 14 Calibration 0x1029f3548 thunk for @escaping @callee_guaranteed () -> () + 27 (:0) 15 libdispatch.dylib 0x18907dcb8 _dispatch_call_block_and_release + 32 16 libdispatch.dylib 0x18907f910 _dispatch_client_callout + 20 17 libdispatch.dylib 0x18908dfa8 _dispatch_main_queue_drain + 984 18 libdispatch.dylib 0x18908dbc0 _dispatch_main_queue_callback_4CF + 44 19 CoreFoundation 0x18934b15c CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 16 20 CoreFoundation 0x189308a80 __CFRunLoopRun + 1996 21 CoreFoundation 0x189307c5c CFRunLoopRunSpecific + 608 22 HIToolbox 0x193884448 RunCurrentEventLoopInMode + 292 23 HIToolbox 0x193884284 ReceiveNextEventCommon + 648 24 HIToolbox 0x193883fdc _BlockUntilNextEventMatchingListInModeWithFilter + 76 25 AppKit 0x18cae2c54 _DPSNextEvent + 660 26 AppKit 0x18d2b8ebc -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716 27 AppKit 0x18cad6100 -[NSApplication run] + 476 28 AppKit 0x18caad3cc NSApplicationMain + 880 29 SwiftUI 0x1b3c14f80 0x1b3b3b000 + 892800 30 SwiftUI 0x1b44a530c 0x1b3b3b000 + 9872140 31 SwiftUI 0x1b48eb4f0 0x1b3b3b000 + 14353648 32 Calibration 0x1029fa1a0 static IntraoralScanMiniProgramApp.$main() + 51 (IntraoralScanMiniProgramApp.swift:14) [inlined] 33 Calibration 0x1029fa1a0 main + 63 (DeviceObject.swift:0) 34 dyld 0x188eb10e0 start + 2360 My mac APP has a crash about DateFormatter. mac version is 14.1.1. public class SULog { private let dateFormatter = { let dateFormatter = DateFormatter() dateFormatter.dateFormte = "yyy-MM-dd HH:mm:ss_sss" return dateFormatter } private var lock = NSLock() public func debug(_ message: Any...) { log(message) } public func log(_ message: Any...) { lock.lock() let date = Date() let dateString = dateFormatter.string(from:date) lock.unlock() print(dateString) } } var log:SULog! class AppDelegate: NSObject { func applicationWillFinishLaunching(_ notification: Notification) { log = SULog() } } public class Test { func test() { autoreleasepool { //.......other code log.debug("test") // crashed //........ other code } } } Any thought on this crash? Thanks
1
0
664
Dec ’23
When iOS17 has a bug and cannot record audio, play the audio to a Bluetooth device
let session = AVAudioSession.sharedInstance() do { try session.setCategory(AVAudioSession.Category.playback) try session.setActive(true) //playAndRecord <AVAudioSessionPortDescription: 0x2828dc2b0, type = Speaker; name = 扬声器; UID = Speaker; selectedDataSource = (null)> //playback <AVAudioSessionPortDescription: 0x28204c1a0, type = BluetoothA2DPOutput; name = M2; UID = 00:02:5C:22:22:11-tacl; selectedDataSource = (null)> print(session.currentRoute.outputs) } catch { print(error) } when I ssession.setCategory(AVAudioSession.Category.playback) audio play output a2dp ble devices. session.currentRoute.outputs print bellow `<AVAudioSessionPortDescription: 0x28204c1a0, type = BluetoothA2DPOutput; name = M2; UID = 00:02:5C:22:22:11-tacl; selectedDataSource = (null)> when I ssession.setCategory(AVAudioSession.Category.playAndRecord) output <AVAudioSessionPortDescription: 0x2828dc2b0, type = Speaker; name = 扬声器; UID = Speaker; selectedDataSource = (null)> BluetoothA2DPOutput is gone. but it is normal in ios15-16. Is there any solution? I want to record audio and play music at the same time. And the music is output from the Bluetooth speaker
1
0
695
Dec ’23
Siri shortcuts in Italian
HI! I'm using shortcuts commands to send http commands to my home automation system. unfortunately from IOS16 onwards they only work when the button is pressed because if I ask Siri to execute a command I get a paragraph telling me that I don't have any devices configured in the "apple home" app. I noticed this problem with Siri in Italian. what can I do? thank you
0
0
522
Dec ’23
Reset specific tip
If I have some tips in an onboarding flow and want to allow my user to restart the onboarding experience, how can I reset specific tips? I know there is Tips.resetDatastore() but I may not want to reset every tip, just some subset of them.
2
1
831
Dec ’23
Screen Time API fails to unblock the apps, and leaves an hourglass shield that doesn't allow unshielding
DL;DR: Sometimes the API fails to unblock the app and leaves an hourglass shield on the restricted apps, which is not set by us. Even worse, if we remove authorization of our app from Settings, the restricted apps remain locked until we restart the phone or re-run our app from Xcode. Our app monitors the usage of selected apps from the current time until the reset time at 4:00 a.m. When the given threshold is reached, the selected apps are shielded. After the user taps the close button on the shield view, we attempt to remove the shield, set up a new threshold monitoring and close the app. The issue is that: sometimes the shield removal fails, and after the app closes itself, it remains shielded, and displays an hourglass shield view that was never in our shield configuration. Additionally, regardless of what we do-removing the shielding from our apps or removing the authorization of our app from Settings, the restricted apps remain shielded until we restart the phone or re-run our app from Xcode. Code I use for un-shielding: warningUsageStore.clearAllSettings() Code I use for scheduling the threshold: var warningMinute = userDefaults.integer(forKey: .warningMinute) if warningMinute <= 0 { warningMinute = 5 } let selection = familyActivitySelection() let now = Date.now let start = Calendar.current.dateComponents([.hour, .minute, .second], from: now) var end = AppConfig.resetEndTime // use twenty minutes later as the end time if the before reset time is too near e.g. warning start at 3:55 but reset time is 4:00 if let endDate = Calendar.current.nextDate(after: now, matching: end, matchingPolicy: .nextTime), endDate.timeIntervalSince(now) <= 15*60 { end = Calendar.current.dateComponents([.hour, .minute, .second], from: now.addingTimeInterval(20*60)) } // add inidividual event according to the hash value to dintinguish between apps. var events = [DeviceActivityEvent.Name : DeviceActivityEvent]() for application in selection.applications where application.token != nil { events[.init(application.hashValue.description)] = .init(applications: [application.token!], threshold: .init(minute: warningMinute)) } for category in selection.categories where category.token != nil { events[.init(category.hashValue.description)] = .init(categories: [category.token!], threshold: .init(minute: warningMinute)) } for webDomain in selection.webDomains where webDomain.token != nil { events[.init(webDomain.hashValue.description)] = .init(webDomains: [webDomain.token!], threshold: .init(minute: warningMinute)) } try deviceActivityCenter.startMonitoring(.usageWarning, during: .init(intervalStart: start, intervalEnd: end, repeats: false), events: events) The issue happens on my iPhone11 iOS17.1.2 Any insight would be much appreciated. Thank you!
0
1
623
Dec ’23
Using Facebook sdk to fetch user profile picture, Do i need Apple sign in as well.
I know that apple requires apple sign in to be added to app , if , in case user adds any sort of social sign in in their app, . But if the purpose of these social sign in is to just fetch profile pictures only, is it also required then. If it is required , then is there any other way , to get user profile picture from facebook account , without adding any social sign in of any kind. to preserve some development and testing time.
0
0
310
Dec ’23
App Transfer to another account (team) - Apple sign in
I have a problem that after the transfer the old users with private email addresses get new email addresses generated upon apple login and I can not connect them to their account in my database. I read that the account that initiates the transfer should "generate a transfer identifier for each user in their database" Is it possible to do this and migrate users after the application has already been transferred successfully to another account?
0
0
344
Dec ’23
Intermittent 404 Not Found responses
For some reason this morning (5 December 2023, ~10:30am UTC) I have been experiencing intermittent WeatherKit API failures with a 404 Not Found status. There is nothing wrong with the request itself: trying a minute or two later with the exact same request parameters and token returns a successful response. I can see that it's not a transport issue between me and Apple, as the response I am getting is coming from the Apple servers: <html> <head> <title>404 Not Found</title> </head> <body> <center><h1>404 Not Found</h1></center> <hr> <center>Apple</center> </body> </html> ...and the responding server is AppleHttpServer. Has anyone else seen this? Is it a regular occurrence, or are they just having a bad day?
10
3
1.6k
Dec ’23
How to use Screen Time API
Hi guys, I am trying to build an app that blocks access to a set of apps defined by a user. Pretty typical app blocking functionality, but I can't find any info about the Screen Time API. I've narrowed it down to DeviceActivity and MangedSetting frameworks but am unsure of which to use. Also, is there a way to get a list of the installed apps on a user's device, or will I have to manually set that?
0
0
433
Dec ’23