There is a crash while running the project in Xcode 16.2. The project has been using CMPedometer and CoreMotion since 2020. I wonder: I did not have the NSMotionUsageDescription key added, why is it mandatory to add this key now?
“This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSMotionUsageDescription key with a string value explaining to the user how the app uses this data.”
General
RSS for tagDelve 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.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
HI there,
when requesting the daily forecast via the WeatherKit REST API, I found out that under certain circumstances the moon phase full is skipped.
Example from Japan (working):
{
"forecastDaily": {
"name": "DailyForecast",
"metadata": {
"attributionURL": "https://developer.apple.com/weatherkit/data-source-attribution/",
"expireTime": "2024-10-21T15:16:10Z",
"latitude": 35.650,
"longitude": 139.840,
"readTime": "2024-10-21T14:16:10Z",
"reportedTime": "2024-10-21T12:00:37Z",
"units": "m",
"version": 1,
"sourceType": "modeled"
},
"days": [
...,
{
"forecastStart": "2024-10-16T15:00:00Z",
"forecastEnd": "2024-10-17T15:00:00Z",
"conditionCode": "MostlyCloudy",
"maxUvIndex": 4,
"moonPhase": "waxingGibbous",
"moonrise": "2024-10-17T07:47:26Z",
"moonset": "2024-10-16T20:09:01Z",
"precipitationAmount": 0.09,
"precipitationChance": 0.43,
"precipitationType": "rain",
...
"windSpeedMax": 16.03,
},
{
"forecastStart": "2024-10-17T15:00:00Z",
"forecastEnd": "2024-10-18T15:00:00Z",
"conditionCode": "Rain",
"maxUvIndex": 4,
"moonPhase": "full",
"moonrise": "2024-10-18T08:20:34Z",
"moonset": "2024-10-17T21:24:49Z",
"precipitationAmount": 4.83,
"precipitationChance": 0.83,
"precipitationType": "rain",
...
"windSpeedMax": 15.57,
},
{
"forecastStart": "2024-10-18T15:00:00Z",
"forecastEnd": "2024-10-19T15:00:00Z",
"conditionCode": "Drizzle",
"maxUvIndex": 5,
"moonPhase": "waningGibbous",
"moonrise": "2024-10-19T08:58:43Z",
"moonset": "2024-10-18T22:42:03Z",
"precipitationAmount": 3.85,
"precipitationChance": 0.76,
...
"windSpeedMax": 28.81,
},
...
]
}
}
Example from Germany where the fullmoon is skipped:
{
"forecastDaily": {
"name": "DailyForecast",
"metadata": {
"attributionURL": "https://developer.apple.com/weatherkit/data-source-attribution/",
"expireTime": "2024-10-21T15:41:17Z",
"latitude": 47.760,
"longitude": 12.650,
"readTime": "2024-10-21T14:41:17Z",
"reportedTime": "2024-10-21T13:00:37Z",
"units": "m",
"version": 1,
"sourceType": "modeled"
},
"days": [
{
"forecastStart": "2024-10-16T22:00:00Z",
"forecastEnd": "2024-10-17T22:00:00Z",
"conditionCode": "MostlyClear",
"maxUvIndex": 3,
"moonPhase": "waxingGibbous",
"moonrise": "2024-10-17T16:07:30Z",
"moonset": "2024-10-17T05:19:30Z",
"precipitationAmount": 0.0,
...
"windSpeedMax": 8.23,
},
{
"forecastStart": "2024-10-17T22:00:00Z",
"forecastEnd": "2024-10-18T22:00:00Z",
"conditionCode": "Cloudy",
"maxUvIndex": 2,
"moonPhase": "waningGibbous",
"moonrise": "2024-10-18T16:30:22Z",
"moonset": "2024-10-18T06:48:39Z",
"precipitationAmount": 1.17,
...
"windSpeedMax": 8.73,
},
{
"forecastStart": "2024-10-18T22:00:00Z",
"forecastEnd": "2024-10-19T22:00:00Z",
"conditionCode": "Cloudy",
"maxUvIndex": 2,
"moonPhase": "waningGibbous",
"moonrise": "2024-10-19T16:59:14Z",
"moonset": "2024-10-19T08:18:33Z",
"precipitationAmount": 0.02,
...
"windSpeedMax": 7.16,
},
]
}
}
As you can see here https://moon.nasa.gov/moon-observation/daily-moon-guide/?intent=011#1729171951907::0:: and on several other sites specialized on the lunar cycle) on 2024-10-17 should be shown full moon.
I know this error is probably because the forecast starts prior to the full moon phase and ends after it but customers don't care about technicalities. They see that there is a full moon missing and complain to me. And they are right. Can you fix this somehow? For example, if a DailyForecast spans the majority of a full moon this Day is marked as full moon.
Another question: Are you considering providing a moonPhase attribute to the "currentWeather" dataset? That would be the best option. (At least for me :))
I’ve implemented an Intent Extension and added support for handling the INSendMessageIntent in the intent handler class.
Currently, this intent is automatically visible in the Shortcuts app by default. However, for security reasons (as it involves handling phone numbers), I want to restrict the use of this intent to Siri only and ensure it does not appear in the Shortcuts app.
Has anyone encountered this requirement before or knows a way to prevent the intent from appearing in the Shortcuts app, while still keeping it functional via Siri?
Looking forward to your suggestions!
Hello,
I have an app on the App Store built around WeatherKit and it was working fine, up until this morning when I started seeing errors when using the app.
When debugging using Xcode I see the familiar error
Failed to generate jwt token for: com.apple.weatherkit.authservice with error: Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 "(null)"
which, according to what I've read on the forums looks like an authentication error.
Attaching a network debugger to the Simulator, I saw this error:
This I have tried:
Verify that WeatherKit is enabled on both Capabilities and App Services tabs on the Dev Portal.
Toggle on/off this value and regenerate Provisioning Profiles
Uninstall/reinstall
Checking that I have API available calls.
Nothing. If I create a new Bundle ID and sign with that, it works correctly. But this is not an option since that will force all my customers to download everything from scratch.
I am getting emails from customers demanding money back and I can't figure out what has happened.
The only thing I can think of, is that I started developing an Apple Watch app to complement the iOS app, but that was last week and everything was working fine.
I have a text based action for iPhone and Mac Catalyst I am developing in Xcode 14.3.1 on macOS 13.4.1.
I have the container app, an action and an AppGroup defined.
I have confirmed that I can read the necessary shared defaults when the action launches.
At this point the UI for the action is a simple textview in which I hope to display a modified version of the text passed to the action in the NSExtensionItems.
I am not using a simulator. I am running the action directly using Xcode.
What is happening is that the ActionViewController viewDidLoad runs but no visible window opens.
In the console I see this as the action launches:
2023-07-05 18:27:23.692277-0700 XYZ[4634:279295] [ViewBridge] ViewBridge attempted to look up a hosted window with identifier 8E816BD5-67D3-402D-ADEB-AC59EDFA1F3B, but it was never registered.
2023-07-05 18:27:23.692408-0700 XYZ[4634:279295] [WindowHosting] UIScene property of UINSSceneViewController was accessed before it was set.
....
The last line above is repeated 12 times....
Any helpful ideas would be deeply appreciated!
Steve
The problem is that when I read out the text in a PDF with page.string or page.attributedString, the context of the lines is lost. Instead of
TermA....23,45
TermB....2,13
in an index document
TermA
TermB
23,45
2,13
is issued. The context of the lines (and the sequence of the letters) is lost. Is there a way to read the text from a PDF line by line?
Hello, I’m working on a caller ID app and with the release of iOS 18.2, Apple has introduced the ability to set a third-party app as the default calling app. I have followed the official documentation for this feature and successfully set my app as the default phone app for making and receiving calls.
Documentation Reference:
https://developer.apple.com/documentation/callkit/preparing-your-app-to-be-the-default-calling-app
Now, I’m facing some challenges and need some guidance:
Custom UI for Incoming Cellular Calls:
Is it possible to show a custom UI when receiving SIM-based cellular calls (not VoIP)? I want to replace the default iOS call screen with my own design when a cellular call is received. Can CallKit allow me to manage and display this custom UI for real cellular calls?
Detecting Incoming Cellular Calls:
Can I detect incoming SIM-based cellular calls when my app is set as the default calling app? I would like to track and show details of incoming calls (e.g., caller information, call duration) using a custom interface.
Displaying Call Data (Call Duration, Recent Calls):
Can I show call data (e.g., call duration, recent call history, etc.) for SIM-based cellular calls within my app when it is the default calling app? I need to know if it’s possible to retrieve and display this data in a custom format.
Managing Outgoing Cellular Calls:
For SIM-based outgoing calls, can I handle the process of initiating the call and then show a custom UI for the call in progress (similar to how VoIP apps manage outgoing calls)?
I understand that CallKit can be used to manage the UI for calls, but I’m unsure about the limitations when it comes to real SIM-based cellular calls. Is it possible to implement these features with the current API capabilities, or are there any restrictions I should be aware of when managing cellular network calls?
Thanks in advance for your help!
Reading text out of PDFs with PDFKit results in some text being returned way out of order when using .string or .attributedString functions. Way out of order means not just wrong sorting of words on a line or wrongly showing up on the next line (as has happened with PDFKit on older iOS releases, e.g. 17.x), but some text (one or more words) may show up near the end of a page of text, while it should show near the beginning.
As Page.characterBounds(at:) is buggy in iOS 18.x returns wrong bounds, devs cannot correct such faulty PDFKit behaviour programmatically.
I believe it is on Apple to fix this iOS 18 bug asap. Thank you for giving it priority as this is killing apps that need PDFKit to get and parse text data out of PDFs.
I have filed Feedback FB16264926.
We are trying to test AdAttributionKit integration and receive a postback in the testing environment with our existing SKAdNetwork identifier and SKAdNetwork certificates, that we had received after registering SKAdNetwork profile via an e-mail.
The issue is that existing certificates were generated by Apple with prime192v1 algorithm, which is not supported by JWT, when we try to create token to sign AdAttribution impression.
We have generated the updated private and public keys according to the documentation https://developer.apple.com/documentation/adattributionkit/registering-an-ad-network.
Is it possible to update our existing SKAdNetwork certificates to the new AdAttributionKit certificates? Or do we need to do something else in order to make our SKAdNetwork certificates work with AdAttributionKit?
Our team has recently added support to our app for Live Activities where the source of the data is driven from the app itself (not push notifications).
We've noticed a crash happening in our core data code caused by the following error thrown by the addPersistentStore function where it would attempt to recover and eventually crash. Here's an error we created to help us debug that contains the error details:
Domain: CoreData Code: 1 NSLocalizedDescription: Error performing migration for databaseName=mydb.sqlite. Error details=The file couldn’t be saved because you don’t have permission. - userinfo: ["reason": No permissions to create file; code = 1]
After some trouble shooting, we managed to reproduce the issue by doing a hard reboot while we're running a live activity. It appears that when the device starts back up, the Live Activity starts which triggers the app to hit didFinishLaunchingWithOptions which is where we get our Core Data store initialized.
The problem is that our app uses Data Protection using NSFileProtectionCompleteUntilFirstUserAuthentication and we'd prefer to keep it that way.
The Core Data db is present in the app sandbox and we're also seeing logs to suggest a failure trying to access NSUserDefaults as well.
Is there an accepted solution for this? Is it expected that a Live Activity would cause an application to launch prior to the device being unlocked for the first time? Is there a way to change that?
On iPhone devices with dynamic islands (e.g. iPhone 15 Pro Max), the proximity sensor takes about 3 seconds to activate, is this normal?
The iPhone 13 responds almost instantly, but the iPhone 15 Pro Max seems to take a while.
class ProximitySensorManager {
// Shared instance for global access (optional)
static let shared = ProximitySensorManager()
// Proximity sensor activation flag
private(set) var isSensorEnabled: Bool = false
// Start observing proximity sensor changes
func enableProximitySensor(observer: Any) {
guard !isSensorEnabled else { return }
isSensorEnabled = true
UIDevice.current.isProximityMonitoringEnabled = true
NotificationCenter.default.addObserver(
observer,
selector: #selector(proximityStateChanged),
name: UIDevice.proximityStateDidChangeNotification,
object: nil
)
}
// Stop observing proximity sensor changes
func disableProximitySensor(observer: Any) {
guard isSensorEnabled else { return }
isSensorEnabled = false
UIDevice.current.isProximityMonitoringEnabled = false
NotificationCenter.default.removeObserver(
observer,
name: UIDevice.proximityStateDidChangeNotification,
object: nil
)
}
// Proximity sensor state change handler
@objc private func proximityStateChanged() {
if UIDevice.current.proximityState {
print("Proximity sensor detected close object")
// Additional functionality can be added here (e.g. lowering the screen brightness)
} else {
print("Proximity sensor detected no object")
}
}
deinit {
//disableProximitySensor() // Clean up observer on deinitialization
}
}
I have a UIApplicationDelegate, where I want to terminate a live activity (in dynamic island) in applicationWillTerminate. However, ending an activity is asynchronous. When I end it within a Task, it's never called.
i thought it is impossible to have CallKit show system UI for outgoing calls. but then i saw this:
"For incoming and outgoing calls, CallKit displays the same interfaces as the Phone app..."
https://developer.apple.com/documentation/callkit
how do i present it though? or is this a documentation error?
Goal: Manually install an explicit version of Rosetta2
Background:
Me and some customers have an old app (intel) which perfectly worked with Rosetta2. In the last week of April most macheines were updated to Mac Os 15.4.1. and the app still starts but certain functionality is bronken. Some fields ind the forms don't write back to the database, some data can't be read from the database.
(Most installations will fade out over the next month but it would be great to have the app fully working for data migration.)
First try was to step back to 15.4. (Clean Install - Install App - Rosetta installs as expected): no change, app still broken
Second try back to 15: (Clean Install - Install App - Rosetta installs as expected): App still broken (!) This is interesting as the app worked for month using Mac Os 15!
Third try: Back to MacOS 14 (Clean Install - Install App - Rosetta installs as expected): App is working like nothing happend.
(All attempts on same hardware of course.)
Reasoning:
Rosetta2 was the only software (besides the app itself) installed after clean MacOS installs. Now, my guess is that there were might be a change in Rosetta2 as the app worked on MacOs 15 up the update 15.4.1. was installed.
Checking versions (pkgutil --pkg-info com.apple.pkg.RosettaUpdateAuto):
Rosetta version MacOS 14: 1.0.0.0.1.1722778371
Rosetta version on MacOS 15.4.1: 1.0.0.0.1.1744447383
To fully verify the cause it would be great to uninstall Rosetta on MacOS15.4.1 machine and explicit install lower version (1.0.0.0.1.1722778371) which must be available somewhere as MacOS14 still gets this version.
I know how to uninstall - is there a possibility to manually install an explicit version of Rosetta2?
Topic:
App & System Services
SubTopic:
General
we have three problem when using the push notification on Live Activity.
1. What is the specific callback strategy for the activityUpdates property in ActivityKit?
We found that in actual user scenarios, there is a probability that we may not receive callbacks. From the community experience, there are some resource optimization strategies that do not perform callbacks. From this perspective, the explanation is kind of vague. Is there any clear feedback to understand why callbacks are performed/not performed?
2.what is the specific description of the wake-up strategy, when background app receive Live Activity offline start Push?
From community experience, we can see that the system may wake up for a duration of 0-30s due to resource optimization strategies, or not wake up/not deal with it. Is there an official description of the wake-up strategy? or we also have to follow this description:
Wake up of apps using content-available pushes are heavily throttled. You can expect 1-2 wakeup per hour as a best case scenario in the hands of your users. so this cannot be assumed to be a reliable wake-up on demand mechanism for an app.
3 How can we determine user have selected (allow or always allow) of the Live Activity permission?
When we use real-time activity offline push, there are two system prompts in iOS:
the first prompt : allow and disallow real-time activity
the second prompt : always allow and disallow
Is there an interface that can directly determine which permission the user has chosen (allow/always allow)? (By the way, we can get disallow status).
At present, we haven't seen any interface in the official documentation/interface that can determine (allow/always allow). The difference here will affect the generation of Update Token. Without Update Token, we can not update our activity instance.
Hi everyone,
I have a simple question regarding App Intents. I have an intent that defines a few parameters, one of which is a Date. When the user is prompted for input, I’d like the date picker to start at a specific value (e.g., tomorrow) instead of the default current date.
Is there a way to set an initial/default value for the date parameter in an App Intent?
Thanks in advance for any guidance!
IMPORTANT Rather than use the code below, I recommend that you adopt Swift’s shiny-new Subprocess package. That’s what I’m doing! (-:
Running a child process using Process (or NSTask in Objective-C) is easy, but piping data to and from the child’s stdin and stdout is surprisingly tricky. I regularly see folks confused by this. Moreover, it’s easy to come up with a solution that works most of the time, but suffers from weird problems that only show up in the field [1].
I recently had a couple of DTS incidents from folks struggling with this, so I sat down and worked through the details. Pasted below is the results of that effort, namely, a single function that will start a child process, pass it some data on stdin, read the data from the child’s stdout, and call a completion handler when everything is done.
There are some things to note here, some obvious, some not so much:
I’ve included Swift and Objective-C versions of the code. Both versions work the same way. The Swift version has all the comments. If you decide to base your code on the Objective-C version, copy the comments from there.
I didn’t bother collecting stderr. That’s not necessary in many cases and, if you need it, it’s not hard to extend the code to handle that case.
I use Dispatch I/O rather than FileHandle to manage the I/O channels. Dispatch I/O is well suited to this task. In contrast, FileHandle has numerous problems working with pipes. For the details, see Whither FileHandle?.
This single function is way longer than I’d normally tolerate. This is partly due to the extensive comments and party due to my desire to maintain focus. When wrapping Process it’s very easy to run afoul of architecture astronaut-ism. Indeed, I have a much more full-featured Process wrapper sitting on my hard disk, but that’s going to stay there in favour of this approach (-:
Handling a child process correctly involves some gnarly race conditions. The code has extensive comments explaining how I deal with those.
If you have any questions or comments about this, put them in a new thread. Make sure to tag that thread with Foundation and Inter-process communication so that I see it.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Indeed, this post shows that I’ve made this sort of mistake myself )-:
Deeplinks in our Mobile (native) application work fine from email clients such as Gmail and Outlook with a default browser such as Safari. If the app is already installed, clicking the link launches it.
However, when we click on the same link from Outlook email with the default browser, Edge, it opens directly in the browser, because any external links in Outlook email route through safe links, which prevents deep linking to the APP.
The current behavior is as follows:
When Safari is the default browser, the process works seamlessly, and the app opens directly. outlook->deep link pressed -> redirect to safari ->opens the app if already installed
However, when Microsoft Edge is set as the default browser, it opens the App Store link in a popover, with an option to open the app if installed.
outlook->deep link pressed -> redirect to Edge->opens the app store inside edge even app already installed
Note : outlook is enforcing safe link policies and also App protection policies.
I would like to achieve the same behavior with Microsoft Edge as with Safari, where the app opens directly rather than redirecting to the App Store.
Is there a specific configuration or workaround to ensure that Microsoft Edge, when set as the default browser, opens the app directly instead of redirecting to the App Store?
Any insights or suggestions would be greatly appreciated.
I am expecting that this safe link works the same as works with a safari in iOS Devices. I have also tried this - https://learn.microsoft.com/en-us/mem/intune/apps/app-protection-policy-settings-ios#exempt-universal-links but not working I'd appreciate it if you could assist me with this matter as soon as possible. How to handle deep links in Outlook when using a default browser like Edge
Hello Apple Developer Community,
We're developing a parental control app using Apple's ScreenTime API and Family Sharing capabilities. We've encountered several persistent issues that are affecting our users' experience. We've found similar reports from other developers, suggesting these might be widespread problems. We're hoping to get some insight or solutions from the community or Apple experts.
Issues we're facing:
Parent apps visible on child's device:
After granting Family Sharing permission on the family picker, sometimes the parent's apps are visible instead of the child's apps.
Related issue: https://forums.developer.apple.com/forums/thread/749672
Inconsistent app visibility on family picker:*
The behaviour of the family picker is unpredictable:
Sometimes, no apps are visible at all, only categories.
Other times, categories are displayed and upon selection, enforcement works correctly.
In some instances, the stream delivering updates to the selection from the app extension doesn't send anything.
Related issue: https://forums.developer.apple.com/forums/thread/729198
Rules not enforced with different OS versions:
When the parent and child devices are running different iOS versions (both above iOS 16), ScreenTime rules don't seem to work correctly.
General inconsistencies:
We've observed various other inconsistencies in the behavior of the ScreenTime API. These issues are less predictable but contribute to an overall unreliable user experience.
Steps to Reproduce:
Add a child device using a parental control app (in our case, Adora for Kids).
Grant the Family Sharing permission.
Open the family picker to set up ScreenTime rules. Observe the inconsistent behaviour:
a. Sometimes no apps are visible.
b. Sometimes only categories are visible.
c. Sometimes both categories and apps are visible.
When categories are visible, select a category and attempt to enforce a rule.
Enforce a ScreenTime rule. Ensure the parent and child devices are running different iOS versions (both iOS 16+).
Test various ScreenTime rules and observe their enforcement across different device configurations.
Questions:
Are these known issues with the ScreenTime API?
What could be causing the inconsistent behavior in the family picker and the stream of updates from the app extension?
Are there any workarounds or best practices to mitigate these problems?
Is there any additional information we can provide to help investigate these issues?
Are there any plans to improve the stability and consistency of the ScreenTime API in future iOS releases?
We've tried researching these issues through various channels, including Apple's documentation and community forums, but haven't found definitive solutions. Any insights or assistance would be greatly appreciated.
Thank you for your time and help!
Environment:
Development: Xcode 15.4, macOS 14.2.1
Runtime: iOS 16+
App: Adora (App Store ID: 1671825554)
I am encountering an issue after transferring an app that uses the FamilyControls framework to a different app account. After releasing a new version of the app post-transfer, the following problems arose:
ApplicationTokens obtained in the pre-transfer version no longer function when used with ManagedSettingsGroup.ShieldSettings in the post-transfer version.
Using the same ApplicationTokens with Label(_ applicationToken: ApplicationToken) does not display the app name or icon.
These issues did not occur in the pre-transfer version and everything worked as expected. We suspect that ApplicationTokens obtained prior to the transfer are no longer valid in the updated app released under the new app account.
We are seeking guidance on the following:
Is this expected behavior after transferring an app to another app account?
What steps should we take to ensure that ApplicationTokens obtained before the transfer remain functional in the post-transfer environment?
If these tokens are invalidated due to the transfer, what are the recommended procedures for regenerating or updating ApplicationTokens for existing app users?
Maintaining a seamless user experience after transferring the app is critical. We would greatly appreciate any insights or guidance. Please let us know if additional information or logs would assist in investigating this issue.
Thank you!
Topic:
App & System Services
SubTopic:
General
Tags:
Family Controls
Device Activity
Managed Settings