Post not yet marked as solved
I've come to the conclusion that TPP and UDP are just utterly wonky together.
This is my relevant code:
let host = NWHostEndpoint(hostname: "", port: "0")
let udpRule = NENetworkRule(destinationNetwork: host, prefix: 0, protocol: .UDP)
let tcpRule = NENetworkRule(destinationNetwork: host, prefix: 0, protocol: .TCP)
let settings = NETransparentProxyNetworkSettings(tunnelRemoteAddress:"127.0.0.1")
/*
* These three lines are a hack and experiment
*/
let quicHost_1 = NWHostEndpoint(hostname: "", port: "80")
let quicHost_2 = NWHostEndpoint(hostname: "", port: "443")
let quicRule_1 = NENetworkRule(destinationNetwork: quicHost_1, prefix: 0, protocol: .UDP)
let quicRule_2 = NENetworkRule(destinationNetwork: quicHost_2, prefix: 0, protocol: .UDP)
settings.includedNetworkRules = [quicRule_1, quicRule_2, tcpRule]
settings.excludedNetworkRules = nil
Directing UDP through a TPP breaks FaceTime, AirDrop, and a bunch of VPNs
Despite the documentation implication that you can't do DNS control with a TPP ("A port string of 53 is not allowed. Use Destination Domain-based rules to match DNS traffic."), if I opt into UDP (settings.includedNetworkRules = [udpRule, tcpRule]), then I see traffic to port 53, and can do things with it.
If I use a wild-card network rule (the code above), then the TPP does not seem to get any UDP flows at all.
If I use a wild-card exclusion rule (using NWHostEndpoint(hostname: "", port: "53")), then everything starts breaking.
If I use NENetworkRule(destinationHost: host, protocol: .UDP), it complains because the prefix must be 32 or less.
I've filed feedbacks, and engaged with eskimo (really, thank you), and looked at previous threads, so mostly this is begging: has anyone gotten this to work as expected? I no longer think I'm being obviously wrong with my code, but I would be super delighted to find out I've missed some tricks or angles.
Post not yet marked as solved
Reproducible on iOS 17.4.1 (maybe before) & iOS 17.5. Maybe iOS 17.4 but I can't test it.
NSMotionUsageDescription is correctly set (and has always been)
Fitness activity & motion authorization are correctly enabled
The delivery for absolute altitude changes became super slow, and might be inaccurate. The only value I get is exactly the same as the GPS altitude. The accelerometer data does not seem to be taken into account anymore.
This critical bug has broken two apps of mine.
How could I quickly solve this?
Thank you!
PS: code is dead simple
let operationQueue = OperationQueue()
self.altimeter.startAbsoluteAltitudeUpdates(to: operationQueue) { [weak self] (data, error) in
guard let self = self else { return }
guard let data else { return }
DispatchQueue.main.async { // Use this value for display
self.altitude = Measurement(value: data.altitude, unit: UnitLength.meters)
/* DEBUG VIEW */
self.updateDebugView(with: data.altitude)
}
}
Post not yet marked as solved
After updating to iOS 17.5 & WatchOS 10.5, the didFinish response from WCSessionDelegate does not come when transferring files from iPhone to Watch.
It worked normally until 17.4 & 10.4.
There is no problem with checking file completion even if a didFinish response is not received, but I think Apple needs to check this issue and update.
File transfer is done using the transferFile function of WCSession.
The file being transferred is a single file and its size does not exceed 30MB.
When you try to transfer Pi, the message below appears in the Xcode log section.
-[WCFileStorage persistOutgoingFileTransfer:] error serializing file transfer <WCSessionFileTransfer: 0x300155d60, session file: <WCSessionFile: 0x3001575c0, identifier: 0C8857EC-7D74-4E78-BA28-6C5526DE8949, file: /private/var/mobile/Containers/Data/Application/DD797847-DED1-42C0-989F-34CD05825007/tmp/C042D096-F12B-4B50-8792-868475DBBF47.zip, hasMetadata: YES>, transferring: YES> due to Error Domain=NSCocoaErrorDomain Code=4866 "Caught exception during archival: This object may only be encoded by an NSXPCCoder.
(
0 CoreFoundation 0x000000019b064f2c 00E76A98-210C-3CB5-930B-F236807FF24C + 540460
1 libobjc.A.dylib 0x0000000192ef6018 objc_exception_throw + 60
2 Foundation 0x0000000199fe7778 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 1419128
3 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428
4 WatchConnectivity 0x000000021d055f60 1AB4DDD6-9238-3965-B744-819F2916C8CC + 126816
5 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428
6 WatchConnectivity 0x000000021d0567f0 1AB4DDD6-9238-3965-B744-819F2916C8CC + 129008
7 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428
8 Foundation 0x0000000199f30628 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 669224
9 WatchConnectivity 0x000000021d0583ac 1AB4DDD6-9238-3965-B744-819F2916C8CC + 136108
10 WatchConnectivity 0x000000021d04390c 1AB4DDD6-9238-3965-B744-819F2916C8CC + 51468
11 WatchConnectivity 0x000000021d046640 1AB4DDD6-9238-3965-B744-819F2916C8CC + 63040
12 Foundation 0x0000000199ea9be0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117728
13 Foundation 0x0000000199ea9aa0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117408
14 Foundation 0x0000000199ea98a0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 116896
15 Foundation 0x0000000199ea7b40 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 109376
16 Foundation 0x0000000199f2c558 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 652632
17 Foundation 0x0000000199f2c1a4 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 651684
18 libdispatch.dylib 0x0000000105ed7764 _dispatch_block_async_invoke2 + 148
19 libdispatch.dylib 0x0000000105ec67bc _dispatch_client_callout + 20
20 libdispatch.dylib 0x0000000105ec98e0 _dispatch_continuation_pop + 676
21 libdispatch.dylib 0x0000000105ec8bb8 _dispatch_async_redirect_invoke + 680
22 libdispatch.dylib 0x0000000105edaae4 _dispatch_root_queue_drain + 404
23 libdispatch.dylib 0x0000000105edb4d8 _dispatch_worker_thread2 + 188
24 libsystem_pthread.dylib 0x00000001f7ebb8f8 _pthread_wqthread + 228
25 libsystem_pthread.dylib 0x00000001f7eb80cc start_wqthread + 8
)" UserInfo={NSDebugDescription=Caught exception during archival: This object may only be encoded by an NSXPCCoder.
(
0 CoreFoundation 0x000000019b064f2c 00E76A98-210C-3CB5-930B-F236807FF24C + 540460
1 libobjc.A.dylib 0x0000000192ef6018 objc_exception_throw + 60
2 Foundation 0x0000000199fe7778 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 1419128
3 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428
4 WatchConnectivity 0x000000021d055f60 1AB4DDD6-9238-3965-B744-819F2916C8CC + 126816
5 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428
6 WatchConnectivity 0x000000021d0567f0 1AB4DDD6-9238-3965-B744-819F2916C8CC + 129008
7 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428
8 Foundation 0x0000000199f30628 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 669224
9 WatchConnectivity 0x000000021d0583ac 1AB4DDD6-9238-3965-B744-819F2916C8CC + 136108
10 WatchConnectivity 0x000000021d04390c 1AB4DDD6-9238-3965-B744-819F2916C8CC + 51468
11 WatchConnectivity 0x000000021d046640 1AB4DDD6-9238-3965-B744-819F2916C8CC + 63040
12 Foundation 0x0000000199ea9be0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117728
13 Foundation 0x0000000199ea9aa0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117408
14 Foundation 0x0000000199ea98a0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 116896
15 Foundation 0x0000000199ea7b40 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 109376
16 Foundation 0x0000000199f2c558 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 652632
17 Foundation 0x0000000199f2c1a4 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 651684
18 libdispatch.dylib 0x0000000105ed7764 _dispatch_block_async_invoke2 + 148
19 libdispatch.dylib 0x0000000105ec67bc _dispatch_client_callout + 20
20 libdispatch.dylib 0x0000000105ec98e0 _dispatch_continuation_pop + 676
21 libdispatch.dylib 0x0000000105ec8bb8 _dispatch_async_redirect_invoke + 680
22 libdispatch.dylib 0x0000000105edaae4 _dispatch_root_queue_drain + 404
23 libdispatch.dylib 0x0000000105edb4d8 _dispatch_worker_thread2 + 188
24 libsystem_pthread.dylib 0x00000001f7ebb8f8 _pthread_wqthread + 228
25 libsystem_pthread.dylib 0x00000001f7eb80cc start_wqthread + 8
)}
Post not yet marked as solved
I'm trying to understand how Apple handles dragging windows around in an immersive space. 3d Gestures seem to be only half of the solution in that they are great if you're standing still and want to move the window an exaggerated amount around the environment, but if you then start walking while dragging, the amplified gesture sends the entity flying off into the distance. It seems they quickly transition from one coordinate system to another depending on if the user is physically moving. If you drag a window and start walking the movement suddenly matches your speed. When you stop moving, you can push and pull the windows around again like a super hero. Am I missing something obvious in how to copy this behavior? Hello world, which uses the 3d gesture has the same problem. You can move the world around but if you walk with it, it flies off. Are they tracking the head movement and if it's moved more than a certain amount it uses that offset instead? Is there anything out of the box that can do this before I try and hack my own solution?
Post not yet marked as solved
Hi! Not sure if this is a swift data or more a Decimal in general type of question.
What's going on:
I have a SwiftUI app using SwiftData, I have persisted a Model with a property "reducedPrice" of type Decimal. It's stores correctly the value.
Now, I have read the value during automated tests and tried comparing the values:
let reducedPrice = model.reducedPrice // swift data property
let target = Decimal(4.98) // expected target value to compare to swift data value.
Now if I just print the result of the comparison between those 2 I get a false result.
print(reducedPrice == target) //output : false
The swift data model was populated from a direct copy of another struct that comes from an JSON import using Codable+CodingKeys (I used Decimal type).
What I expected:
I expected it to be true.
Debug Observations
I did noticed that on the variable inspector both had the same magnitudes but in reality the mantissa are different. I'm attaching a screenshot.
My Theory
They are different just because something under SwiftData stores different way the decimal as in comparison on how I am creating the Decimal for the comparison inside the automated tests.
My question
Is this expected behavior?
Any suggestion on best practices on how to handle this?
Thank you in advance any relevant guidance is very appreciated!
Post not yet marked as solved
I've been developing a solution that has an embedded USB driver. I can build and run my solution just fine but I cannot pass verification for uploading to App Store Correct and TestFlight
The problem is that the provisioning profile I am using (for development) does not have the explicit Vendor ID (idVendor) but is using the development value of asterisk "*". I've created a release version of my entitlements file with the proper Vendor ID and I have a distribution certificate for iOS. Further, I've created a provisioning profile for app-store distribution (not development) and imported it via Xcode. When I select this provisioning profile, I get the following errors from Xcode:
Xcode 14 and later requires a DriverKit development profile enabled for iOS and macOS. Visit the developer website to create or download a DriverKit profile.
Provisioning profile "MyProvisioningProfile - App Store" doesn't match the entitlements file's value for the com.apple.developer.driverkit.transport.usb entitlement.
If I create and use a DriverKit profile, The Xcode UI errors go away on the "Signing & Capabilities" page. However, these profiles seem to be for development only. I then get an error, during compilation, telling me that the app and extension have two different signers, one for development (DEXT) and one for distribution (App).
To sum up, using a DriverKit profile fails during the build process and using a distribution profile is a non-starter for Xcode. I can't even build.
What do I need to do to get this to work?
Post not yet marked as solved
I'm using the systemMusicPlayer to play music and want to update the playback time using addObserver forKeyPath.
[self setMusicPlayer: [MPMusicPlayerController systemMusicPlayer]];
I've tried these two methods:
[self addObserver:self forKeyPath:@"musicPlayer.currentPlaybackTime" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial context:&musicPlayer];
[self.musicPlayer addObserver:self forKeyPath:@"currentPlaybackTime" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial context:&musicPlayer];
I do get the initial values for currentPlaybackTime in:
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
but I never get any calls when the player is playing the song (the whole point).
If I set the currentPlaybackTime to a specific value (locating manually using a slider), I get calls with the values I set (useless since I know what I am setting them to).
How are we supposed to track the playback time without just polling it constantly?
Post not yet marked as solved
I am trying to launch openImmersiveSpace, but seem like there is an issue with the openImmersiveSpace Task.
Error: Static method 'buildExpression' requires that 'Task<OpenImmersiveSpaceAction.Result, Never>' conform to 'View'
Here is the code and the error shows up on the "Task" line.
import SwiftUI
import RealityKit
import RealityKitContent
struct TestView: View {
@Environment(\.openImmersiveSpace) var openImmersiveSpace
@Environment(\.dismissImmersiveSpace) var dismissImmersiveSpace
var body: some View {
VStack{
Text("Open Full Immersive & switch to NextViewArea")
NavigationLink {
Task {
await openImmersiveSpace(id: "ImmersiveSpace")
}
NextViewArea()
} label:{
Label(" Enter Full Immersive Space")
}
}
}
}
How can I move onto the next view area in the floating window while also launching full immersive space. Any help would be much appreciated.
Post not yet marked as solved
I'm trying to broadcast some customized data into the peripheral advertisingData package. Based on the WWDC 2019, and some posts Ios BLE extended Advertising example, seems like with iphone devices that support bluetooth 5.0, we can send up to 124 bytes.
However Apple didn't say how to send extensive advertisement data (which key or API to use). And I tested with the CBAdvertisementDataLocalNameKey, seems like I can still ONLY send within 31 bytes. My code:
@IBAction func switchChanged(_ sender: Any) {
// All we advertise is our service's UUID.
if advertisingSwitch.isOn {
peripheralManager.startAdvertising([CBAdvertisementDataServiceUUIDsKey: [TransferService.serviceUUID], CBAdvertisementDataLocalNameKey: "1234567890asddsgsfhgfshfgshfsggdrfgdbfsbfgshgfshbfgb"])
} else {
peripheralManager.stopAdvertising()
}
}
And on the central side, my code:
func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String: Any], rssi RSSI: NSNumber) {
if let name = advertisementData[CBAdvertisementDataLocalNameKey] as? String {
os_log("name:", String(name))
}
}
But I only got the first some bytes:
name String "1234567890asddsgsfhgfshfgs"
My question is, does apple really support Extended Advertising starting from iPhone 8? If so, how should I use it to send data up to 124 bytes?
Post not yet marked as solved
Our product includes a sudo plugin so we can apply user-defined policies to manage privileged access to command line programs. We’ve been getting reports where the plugin sometimes doesn't get invoked and the sudo command falls back to its default behavior. This seems to only be happening intermittently, but when the issue does occur, this message appears in the Console:
Library Validation failed: Rejecting '/usr/local/libexec/sudo/<our_plugin>.so' (Team ID: <OURTEAMID>, platform: no) for process 'sudo(<pid>)’ (Team ID: N/A, platform: yes), reason: mapping process is a platform binary, but mapped file is not
I recall a previous discussion of this message (that I can’t locate now), which explained that although the host process has library validation disabled, the code flow raises an error anyway, so that the host process can detect it and bypass the validation to load the plugin. It looks like that's what sudo is doing: it has the private entitlement com.apple.private.security.clear-library-validation and makes the appropriate system call when the plugin initially fails to load [1] — but apparently this isn't working reliably for our sudo plugin.
We’ve observed that restarting the Mac generally resolves the issue, at least for a while. This resembles the “classic symptom of a code signing oddity” where the signature is cached and the Mach-O image is rewritten rather than replaced (as documented in Updating Mac Software). But our software uses an Installer package for updates as well as initial installation, and the Installer is documented as not having this issue, so I believe the problem lies somewhere else.
I’m running out of ideas; are there any other avenues I should investigate? Thanks for any help.
[1] This is described in an article called "About com.apple.private.security.clear-library-validation"; I can't link to it directly from the developer forums, but it can easily be found by searching for the title.
Post not yet marked as solved
Hi everyone, I am having a problem on AVPlayer when I try to play some videos.
The video starts for a few seconds, but immediately after I see a black screen and in the console there is the following error:
<__NSArrayM 0x14dbf9f30>(
{
StreamPlaylistError = "-12314";
comment = "have audio audio-aacl-54 in STREAMINF without EXT-X-MEDIA audio group";
date = "2024-05-13 20:46:19 +0000";
domain = CoreMediaErrorDomain;
status = "-12642";
uri = "http://127.0.0.1:8080/master.m3u8";
},
{
"c-conn-type" = 1;
"c-severity" = 2;
comment = "Playlist parse error";
"cs-guid" = "871C1871-D566-4A3A-8465-2C58FDC18A19";
date = "2024-05-13 20:46:19 +0000";
domain = CoreMediaErrorDomain;
status = "-12642";
uri = "http://127.0.0.1:8080/master.m3u8";
}
)
Post not yet marked as solved
It's more than 2 business day. we running out of time. Tim ****, please speed up the process
Post not yet marked as solved
I have encountered a strange behavior these past couple weeks while dealing with Bluetooth, mostly because my code hasn't changed in over 6 months (maybe it was not working before and now it's correct, who knows). Essentially, when i pair with a bluetooth device for the first time, the onchange has stopped firing. I can post more exact code of the view but I didn't think it was necessary but after you select the device you want to connect to (for the first time) you get asked by the OS to pair. After successful connection, we read information from the device (the Profiles). Once I get that information, i set dataGathered to true which triggers .onChange and I can navigate. However, with this initial connection/pairing the .onChange is never triggered, but i know i'm getting my dataGathered set to true because my print is being set. Subsequent connections do cause .onChange to be triggered with 0 profiles and with many profiles. This code hasn't changed in months so i'm not sure if there's SwiftUI bug that's sprung up or what, or if there's an inherint issue with what i was doing and it's only now being caught.
struct DeviceSearchView: View {
@StateObject var connectedManager: Manager = Manager()
@StateObject var bluetoothListener: Listener = BluetoothListener()
var body: some View {
body
.onChange(self.bluetoothListener.connectedDevice) { device in
device.getData()
}
.onChange(self.connectedManager.dataGathered) { dataGathered in
// determine navigation
}
}
}
Manager Object
final class Manager: ObservedObject, BTDelegate, Identifiable /*i've tried adding/switching with Equatable but no change*/ {
@Published var dataGathered: Bool = false
@Published var profileList: Profile = [Profile]()
@Published var index: Int = 0
func updatedProfile(list: NSArray, selectedIndex: Int) {
print("profiles are in fact here")
var newList = [Profile]()
for element in list {
if let profile = element as? B50Profile {
print("\(profile.name)")
if !newList.contains(profile){
newList.append(profile)
}
}
}
self.profileList = newList
self.index = selectedIndex
self.dataGathered = true
print("data gathered is \(self.dataGathered)"
}
}
Post not yet marked as solved
Hi all,
I'm working on a small PoC to get Content Filtering (FilterDataProvider) working on macOS without any user interaction.
So far, I've pushed two payloads to my machine using user-approved MDM enrollment:
com.apple.system-extension-policy
com.apple.webcontent-filter
The application containing the network extension is present in /Applications.
The installation of the profiles both succeed and I can see a Content Filter is created in the Network section of System Settings. Even the status says "Enabled", but the dot remains orange.
Inspecing the system logs (specifically: filtering on process:neagent) shows me the following error:
1. Failed to find a com.apple.networkextension.filter-data extension inside of app com.my.app.containing.the.ext
Only when I submit an activation request using OSSystemExtensionRequest.activationRequest, the network extension starts (without prompts, as expected) and everything works.
Is this expected behaviour? Do I need to submit an activation request through code regardless of the fact that MDM pre-approved the System Extension prompts and created the Content Filter in the System Settings?
Post not yet marked as solved
Hello,
We have discovered an app on the App Store that has copied our application entirely, including the UI interface, icons, and artwork. The only difference is a single letter in the app name, while the logo remains remarkably similar. We couldn't find a report button on the App Store page. How can we report it?
Thank you,
Post not yet marked as solved
Hi!
I would like to release my app in the EU, and I would be classified as trader.
Thereby I have to hand over some data like address, phone number etc.
My question is: can I use a VoIP number as phone number? I'm just concerned about the sms verification.
Much appreciated!
Post not yet marked as solved
Hi everybody,
I'm trying to implement Firebase messaging into a new iOS app.
I've done everything (add Background Mode and Push Notification capabilities, import my key into FIrebass, ...) as describe in different tutorials that I founded on internet.
The fact is that the console doesn't show me a token..
Does someone has an idea ?
Here's my code :
// pushnotifApp.swift
// pushnotif
//
// Created by Thibault COLLIN on 13/05/2024.
//
import SwiftUI
import FirebaseCore
import FirebaseMessaging
import UserNotifications
class AppDelegate: NSObject, UIApplicationDelegate, MessagingDelegate, UNUserNotificationCenterDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
print("Application did finish launching")
FirebaseApp.configure()
Messaging.messaging().delegate = self
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(options: authOptions) { (granted, error) in
if granted {
print("Notification authorization granted")
DispatchQueue.main.async {
application.registerForRemoteNotifications()
}
} else {
print("Notification authorization denied")
}
}
return true
}
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
print("Firebase registration token received: \(String(describing: fcmToken))")
}
}
@main
struct pushnotifApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
And the console result :
Application did finish launching
10.26.0 - [FirebaseMessaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
Notification authorization granted
Post not yet marked as solved
Hello,
I'm working on an app that makes use of Screen Time features by leveraging the Family Controls, Device Activity and Managed Settings frameworks.
The main app works fine by shielding/unshielding apps with a toggle.
When it comes to monitoring the time intervals with the Device Activity Monitor (DAM) extension (e.g. lock X apps for Y minutes), I'm experiencing several issues.
To shield/unshield apps and kick off the monitoring I perform the following instructions:
let timeInMinutes = 15
let startDate = Date(timeIntervalSinceNow: 1.0) // padding added to avoid invalid DAM ranges < 15 mins.
let endDate = startDate.addingTimeInterval(timeInMinutes * 60.0)
let components: Set<Calendar.Component> = [.day, .month, .year, .hour, .minute, .second]
let calendar = Calendar.current
let intervalStart = calendar.dateComponents(components, from: startDate)
let intervalEnd = calendar.dateComponents(components, from: endDate)
let schedule = DeviceActivitySchedule(intervalStart: intervalStart, intervalEnd: intervalEnd, repeats: false)
try deviceActivityCenter.startMonitoring(.definiteShield, during: schedule)
let managedSettingsStore = ManagedSettingsStore()
managedSettingsStore.shield.applications = selection.applicationTokens // `selection` being an instance of `FamilyActivitySelection`
The main pain points are:
After this code is performed, I would expect the Device Activity Monitor extension to start, or at least to start once I go to background. To check whether the DAM extension is running or not, I attach to the extension process manually (Product > Attach to Process by PID or Name). But I can see the extension correctly running only after 3-4 attempts of calling startMonitoring.
Even when the DAM extension runs, intervalDidStart and intervalDidEnd methods in the extension are called quite randomly - most of the times not being called at all - thus making the extension hugely unaffordable.
Please note:
I already ask for Screen Time permissions during the onboarding by calling AuthorizationCenter.shared.requestAuthorization(for: .individual), so by the time the user shields the apps, these permissions are already granted.
I already have Family Control entitlements for development and distribution, and for both the main target and the DAM extension target.
In the intervalDidEnd method, I simply call ManagedSettingsStore().clearAllSettings() and DeviceActivityCenter().stopMonitoring(). This looks like to be enough to stay way below the 6MB memory limit.
Am I doing something wrong, is there a way to fix this, or is just the Device Activity framework that is unstable?
Post not yet marked as solved
I am running two different background modes(not at the same time), 1 with a workout and 1 with a location. I noticed that the app logo appears above the watch face for both background modes but does not show up consistently. I wonder what the significance of the logo showing up above watch face is? Additionally why does it show up sometimes but not others?
Thanks
Post not yet marked as solved
I am unsure what happened, but almost all my documents are missing from multiple folders on my Mac and cloud. I have reviewed all the diagnostics posted on the Apple websites and Q and A to recover it. Everything I have tried.
When I can find some of those documents listed (some being Excel spreadsheets) in their app and try to open them, it says that the file has been deleted or is currently not accessible. All of these documents were saved on my desktop, and I searched the computer far and wide, downloaded recovery apps to find them, and found nothing. I am not even sure how they disappeared. I tried updating my Mac to the newest software. As I read, they may appear after that, but there is still nothing.