Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

XCFramework Location Behavior Differs from Standalone App in Background/Sleep Mode

Hi Apple Dev Team & Community,

We’ve encountered an issue with background location updates when using an XCFramework we’ve built from our main app.

Context: We have a standalone app called TravelSafely that reliably performs background location updates and alerts, even during sleep mode. From this app, we extracted some core functionality into an XCFramework, including location management, and provided it as an SDK to a client. We created a demo app to test this SDK in isolation.

Problem: In the demo app, we notice that location updates work fine in the foreground. However, in the background or sleep mode, location updates sometimes stop completely. When we bring the app to the foreground again, location resumes. This does not happen in the original standalone app. What We’ve Already Checked: UIBackgroundModes includes location Info.plist has the required permissions Location is started correctly using startUpdatingLocation We maintain strong references and use background tasks as needed

Question: Why would an app using a binary XCFramework (with location logic) behave differently from the original app in terms of background execution?

Is there any known issue or recommendation when working with SDKs/XCFrameworks that need to manage background tasks and location updates?

Any insights or recommendations to maintain proper background behavior would be highly appreciated.

Thank you!

Answered by DTS Engineer in 842026022
Why would an app using a binary XCFramework … behave differently from the original app in terms of background execution?

It wouldn’t. Access to location is managed on a per-process basis. Moving code from an app to a framework, or between frameworks, should have no impact on its ability to use Core Location.

It’s extremely likely that something else is going on here.

UIBackgroundModes includes location Info.plist

You’re checking the app’s Info.plist, right? Because that property is not effective in the framework’s Info.plist.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Why would an app using a binary XCFramework … behave differently from the original app in terms of background execution?

It wouldn’t. Access to location is managed on a per-process basis. Moving code from an app to a framework, or between frameworks, should have no impact on its ability to use Core Location.

It’s extremely likely that something else is going on here.

UIBackgroundModes includes location Info.plist

You’re checking the app’s Info.plist, right? Because that property is not effective in the framework’s Info.plist.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi Quinn,

Thanks for the clarification that helps narrow it down.

We’ve double-checked that the app’s Info.plist (not the framework’s) includes the correct UIBackgroundModes and location permission keys. We’re now reviewing the remaining setup, lifecycle handling, and differences from our working standalone app.

Would it be okay if I share a sample project or code snippet that reproduces the issue?

I’d appreciate it if you could take a look or let me know what might be best to include for further analysis.

Thanks again!

Would it be okay if I share a sample project or code snippet that reproduces the issue?

Well, it’d be OK to share, but there’s very little chance of me looking at this week, it being WWDC and all |-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Can you guide me, how can I get location continuously in background or sleep mode? Here is the location manager code UIApplication.shared.isIdleTimerDisabled = true self.locationManager.desiredAccuracy = kCLLocationAccuracyBest //kCLLocationAccuracyBestForNavigation self.locationManager.delegate = self self.locationManager.requestAlwaysAuthorization() self.locationManager.allowsBackgroundLocationUpdates = true self.locationManager.pausesLocationUpdatesAutomatically = false if CLLocationManager.headingAvailable() { locationManager.headingFilter = 1 locationManager.startUpdatingHeading() }

here is Plist

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleGetInfoString</key> <string></string> <key>CFBundleIcons</key> <dict/> <key>CFBundleIcons~ipad</key> <dict/> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLName</key> <string>com.travelsafely.development</string> <key>CFBundleURLSchemes</key> <array> <string>travelsafely</string> </array> </dict> </array> <key>FirebaseAppDelegateProxyEnabled</key> <string>NO</string> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSExceptionDomains</key> <dict> <key>localhost</key> <dict> <key>NSExceptionAllowsInsecureHTTPLoad</key> <true/> <key>NSIncludesSubdomains</key> <true/> </dict> </dict> </dict> <key>NSUserActivityTypes</key> <array> <string>CloseRecordDriveIntent</string> <string>StartRecordDriveIntent</string> </array> <key>UIAppFonts</key> <array> <string>exljbris - MuseoSansRounded-500.otf</string> <string>exljbris - MuseoSansRounded-700.otf</string> </array> <key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <string>Allow NTTAAiiApp to fetch location.</string> <key>NSLocationAlwaysUsageDescription</key> <string>Allow NTTAAiiApp to fetch location.</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Allow NTTAAiiApp to fetch location.</string> <key>UIBackgroundModes</key> <array> <string>fetch</string> <string>audio</string> <string>location</string> </array> <key>UIFileSharingEnabled</key> <true/> <key>UIStatusBarTintParameters</key> <dict> <key>UINavigationBar</key> <dict> <key>Style</key> <string>UIBarStyleDefault</string> <key>Translucent</key> <false/> </dict> </dict> <key>UISupportedExternalAccessoryProtocols</key> <array> <string>com.smartdevicelink.prot29</string> <string>com.smartdevicelink.prot28</string> <string>com.smartdevicelink.prot27</string> <string>com.smartdevicelink.prot26</string> <string>com.smartdevicelink.prot25</string> <string>com.smartdevicelink.prot24</string> <string>com.smartdevicelink.prot23</string> <string>com.smartdevicelink.prot22</string> <string>com.smartdevicelink.prot21</string> <string>com.smartdevicelink.prot20</string> <string>com.smartdevicelink.prot19</string> <string>com.smartdevicelink.prot18</string> <string>com.smartdevicelink.prot17</string> <string>com.smartdevicelink.prot16</string> <string>com.smartdevicelink.prot15</string> <string>com.smartdevicelink.prot14</string> <string>com.smartdevicelink.prot13</string> <string>com.smartdevicelink.prot12</string> <string>com.smartdevicelink.prot11</string> <string>com.smartdevicelink.prot10</string> <string>com.smartdevicelink.prot9</string> <string>com.smartdevicelink.prot8</string> <string>com.smartdevicelink.prot7</string> <string>com.smartdevicelink.prot6</string> <string>com.smartdevicelink.prot5</string> <string>com.smartdevicelink.prot4</string> <string>com.smartdevicelink.prot3</string> <string>com.smartdevicelink.prot2</string> <string>com.smartdevicelink.prot1</string> <string>com.smartdevicelink.prot0</string> <string>com.ford.sync.prot0</string> <string>com.smartdevicelink.multisession</string> </array> <key>UIViewControllerBasedStatusBarAppearance</key> <true/> </dict> </plist>

let me know what else you need?

What you’ve posted is pretty much unreadable. Can you try again, this time using code blocks so that the preformatted text renders nicely. See Quinn’s Top Ten DevForums Tips for specific advice, and lots of other hints and tips on how to use the forums effectively.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Can you guide me, how can I get location continuously in background or sleep mode? Here is the location manager code

UIApplication.shared.isIdleTimerDisabled = true

self.locationManager.desiredAccuracy = kCLLocationAccuracyBest

//kCLLocationAccuracyBestForNavigation self.locationManager.delegate = self

self.locationManager.requestAlwaysAuthorization()

self.locationManager.allowsBackgroundLocationUpdates = true self.locationManager.pausesLocationUpdatesAutomatically = false

if CLLocationManager.headingAvailable() { locationManager.headingFilter = 1 locationManager.startUpdatingHeading() }

What other code you need to have look?

I don’t have a lot of experience with Core Location — I waded into this thread because of your framework issue — so I asked DTS’s expert on this topic and he suggested that you start with Handling location updates in the background. Additionally, there are two samples that you should find useful:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

XCFramework Location Behavior Differs from Standalone App in Background/Sleep Mode
 
 
Q