Application Services

RSS for tag

Perform common application tasks using Application Services.

Posts under Application Services tag

8 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

NSApplicationDelegate open URLs only called after second drop
I want to make a simple droplet application. I've set the document types to include com.adobe.pdf files, and I am now receiving callbacks to the app delegate's application(_:open:) callback when I drop PDFs on the app icon… But not the first time. It doesn't matter how long I wait, or whether the app is already open—the first drop never triggers the callback. All subequent drops work as expected, and I get URLs to all the files dropped. What might be wrong? How can I debug this?
1
0
282
Oct ’24
Unexpected behavior when iPad is unlock and the application goes to Foreground. something happens and the application goes to background and foreground in a small period of time.
I have the our device connected , with Assistive Touch enabled and the application running in the foreground. At this point, I place the screen on standby and leave the device unattended for 10 minutes. After this period, I return, unlock the screen, and observe that our app is still running, and the connection with the device is re-initiated. However, something occurs at this stage that causes the application to briefly switch to the background and then immediately return to the foreground. This behavior leads to system instability. Ideally, once the application is running in the foreground, it should not transition to the background automatically. However, it seems to be doing so for a short duration—momentarily switching from the foreground to the background, then back to the foreground—which is causing the observed instability. OK, the iPad screen is unlocked AND App Appears. 2024-10-01 13:15:55 LOG: APP > Scene did become active 2024-10-01 13:15:55 LOG: APP > Init device Suddenly the application goes to background by itself?!?!?! 2024-10-01 13:15:55 LOG: APP > Scene will change from Foreground to Background 2024-10-01 13:15:55 LOG: APP > Scene changed to Background 2024-10-01 13:15:56 LOG: APP > Scene Will Enter to Foreground 2024-10-01 13:15:56 LOG: APP > Nib Name previous load : Home Other example OK, the iPad screen is unlocked AND App Appears. 2024-10-01 11:23:55 LOG: APP > Scene Will Enter to Foreground 2024-10-01 11:23:56 LOG: APP > Scene did become active 2024-10-01 11:23:56 LOG: APP > Init connection Suddenly the application goes to background by itself?!?!?! 2024-10-01 11:23:56 LOG: APP > Scene will change from Foreground to Background 2024-10-01 11:23:56 LOG: APP > Scene changed to Background 2024-10-01 11:23:56 LOG: APP > Scene Will Enter to Foreground 2024-10-01 11:23:56 LOG: APP > Scene did become active 2024-10-01 11:23:56 LOG: APP > Scene will change from Foreground to Background 2024-10-01 11:23:56 LOG: APP > Scene changed to Background 2024-10-01 11:23:56 LOG: APP > Scene Will Enter to Foreground 2024-10-01 11:23:56 LOG: APP > Nib Name previous load : Home FA FB15345245 this is happening under iPadOS18.1 beta5 and iPad12.9" 6th gen. Would you mind taking a look at this issue ?
2
0
332
Oct ’24
Creating ApplicationToken with Decoder from string
I've been working a lot with the FamilyControls API and App Shield recently but have encountered a problem with no documentation. I used the FamilyActivitySelection to select the app store to shield(This is just for testing), and then printed out the application token: 1wfY¸êB ò S« öi #×(É?âðw ù/jQ ¿ J ïE¢? ·¿ º<Òd?ý r7¥Ãn N átJ¹ÿ85B_{VAF fC8. ,,¸¯3 T7F ±õü; ¹?v@¯ô Ä \-õ# Ò I know the application token is a Codable object so I was wondering, How do I create an application token using the Token<Application> initializer init(from: any Decoder) throws Creates a new instance by decoding from the given decoder. Using the above data? Do I have to encode first in order to decode it? For reference, the code I tried to use is: newValue.applicationTokens.encode(to: JSONEncoder) if let encoded = try? JSONEncoder().encode(newValue.applicationTokens) { data = encoded print(String(data: data, encoding: .utf8)!) } if let app = try? JSONDecoder().decode(Token<Application>.self, from: data) { let token = Application(token: app) print(token) } else { print("didn't work") } But it prints didn't work every time. What should I do differently?
1
0
333
Aug ’24
Receiving Error Messaging Opening VLC
I've uninstalled and reinstalled VLC media player multiple times. However, I receive the following message opening the app after each installation: Translated Report (Full Report Below) Process: VLC [71778] Path: /Applications/VLC2.app/Contents/MacOS/VLC Identifier: org.videolan.vlc Version: 3.0.21 (3.0.21) Code Type: ARM-64 (Native) Parent Process: launchd [1] User ID: 501 Date/Time: 2024-08-14 12:27:24.3563 -0400 OS Version: macOS 14.6.1 (23G93) Report Version: 12 Anonymous UUID: 9DDE1CE7-A635-1165-0FE9-04EA599A542F Sleep/Wake UUID: E22A843E-7A51-414F-BA7F-AB35B1674915 Time Awake Since Boot: 300000 seconds Time Since Wake: 267959 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000102af4ae8 Exception Codes: 0x0000000000000001, 0x0000000102af4ae8 Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11 Terminating Process: exc handler [71778] VM Region Info: 0x102af4ae8 is not in any region. Bytes after previous region: 2793 Bytes before following region: 783640 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL __LINKEDIT 102ae8000-102af4000 [ 48K] r--/rwx SM=COW /Applications/VLC2.app/Contents/Frameworks/Breakpad.framework/Versions/A/Resources/breakpadUtilities.dylib ---> GAP OF 0xc0000 BYTES __TEXT 102bb4000-102c78000 [ 784K] r-x/rwx SM=COW /Applications/VLC2.app/Contents/MacOS/lib/libvlccore.9.dylib Application Specific Information: *** multi-threaded process forked *** crashed on child side of fork pre-exec Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_trace.dylib 0x193d8b0c0 _os_log_preferences_refresh + 68 1 libsystem_trace.dylib 0x193d8bb20 os_log_type_enabled + 712 2 CoreFoundation 0x1940da800 _CFBundleCopyPreferredLanguagesInList + 516 3 CoreFoundation 0x1940e75a4 _CFBundleCopyLanguageSearchListInBundle + 124 4 CoreFoundation 0x1940e738c _copyQueryTable + 64 5 CoreFoundation 0x1940e6d5c _copyResourceURLsFromBundle + 376 6 CoreFoundation 0x1940e6118 _CFBundleCopyFindResources + 1400 7 CoreFoundation 0x1940e5b90 CFBundleCopyResourceURL + 56 8 CoreAudio 0x1966c3b58 HALSystem::InitializeShell() + 1412 9 CoreAudio 0x1966c3274 HALSystem::CheckOutInstance() + 192 10 CoreAudio 0x19693360c AudioObjectSetPropertyData_mac_imp + 116 11 libauhal_plugin.dylib 0x10290915c 0x102904000 + 20828 12 VLC 0x1025df4dc 0x1025d8000 + 29916 13 dyld 0x193cb3154 start + 2476 Thread 0 crashed with ARM Thread State (64-bit): x0: 0x00000001fbe8cfec x1: 0x0000000193da0985 x2: 0x0000000001000104 x3: 0x0000000000000000 x4: 0x0000000193da0937 x5: 0x000000016d826500 x6: 0x0000000000000074 x7: 0x0000000000000000 x8: 0x0000000102af4ae6 x9: 0x00000001fbe97610 x10: 0x0000000000000001 x11: 0x0000000143909730 x12: 0x0000000000000001 x13: 0x000000016d8266f0 x14: 0xaaaaaaaaaaaaaaaa x15: 0x0000000193da01db x16: 0x0000000193ffd7d4 x17: 0x000000020658e3e0 x18: 0x0000000000000000 x19: 0x0000000143909700 x20: 0x0000000143909700 x21: 0x0000000102af4aea x22: 0x0000000102af4aea x23: 0x0000000143d069f0 x24: 0x0000000143d075a0 x25: 0x0000000000000016 x26: 0x0000000000000000 x27: 0x0000000143d07c60 x28: 0x0000000143d06af0 fp: 0x000000016d826a30 lr: 0x0000000193d8b0a4 sp: 0x000000016d8269e0 pc: 0x0000000193d8b0c0 cpsr: 0x20001000 far: 0x0000000102af4ae8 esr: 0x92000007 (Data Abort) byte read Translation fault
1
0
458
Aug ’24
How to get which app is currently being used by user
Hello! I'm designing an app that tracks users' screen time and shares it with each other. I've looked extensively into the ScreenTimeAPI and it seems as if Apple doesn't allow any way to share screen time data. Even with the user's permission. I was wondering whether there is a way that my app (running in the background) would be able to get whether the user was currently using the notes app (or any other app). I was looking into the AppTrackingTransparency framework to see if this functionality was at all possible, but came up short of finding an answer. Is this possible? My guess is no but still wanted to check.
1
0
422
Aug ’24
Error when trying to check the daemon registration of our application
Hello, Our product registers a daemon in the system through SMAppService (API available from Ventura) and also checks its status in case it has to tell the user to allow the daemon process as a background process. To check the status we call a script written in applescript that returns the status of the service. Script excerpt: NSString* scriptText = @"use framework "AppKit"\n" @"use framework "ServiceManagement"\n" @"use scripting additions\n" @"on startCommand()\n" @"try\n" @"local this, service, SMAppServiceInstance, ret\n" @"set this to a reference to current application\n" @"set SMAppServiceInstance to a reference to SMAppService of this\n" @"set service to SMAppServiceInstance's daemonServiceWithPlistName: "%@"\n" @"set str to service's status as string\n" @"set success to str as number\n" @"return success\n" @"on error errorMessage number errorNumber\n" @"log ("errorMessage: " & errorMessage & ", errorNumber: " & errorNumber)\n" @"end try\n" @"return -1\n" @"end startCommand\n"; The problem we see is sometimes when we try to check the status, a thread that is created when executing the script crashes. This is an error but it doesn't always occur at this point: Crashed Thread: 6 Dispatch queue: com.apple.root.utility-qos.overcommit Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6 Terminating Process: psanwatchdog [61506] Error Formulating Crash Report: PC register does not match crashing frame (0x0 vs 0x7FF89D102A78) Thread 6 Crashed:: Dispatch queue: com.apple.root.utility-qos.overcommit 0 ??? 0x7ff89d102a78 ??? 1 libsystem_kernel.dylib 0x7ff80ce7314a __pthread_kill + 10 2 libsystem_pthread.dylib 0x7ff80ceabebd pthread_kill + 262 3 libsystem_c.dylib 0x7ff80cdd1a39 abort + 126 4 libsystem_c.dylib 0x7ff80cdd0d1c __assert_rtn + 314 5 CoreFoundation 0x7ff80d0e1104 -[__NSPlaceholderDate initWithTimeIntervalSinceReferenceDate:].cold.2 + 35 6 CoreFoundation 0x7ff80cf44cfc -[__NSPlaceholderDate initWithTimeIntervalSinceReferenceDate:] + 370 7 CoreServicesInternal 0x7ff81038da12 BookmarkData::copyItem(CFBookmarkDataItem const*, std::__1::set<CFBookmarkDataItem const*, std::__1::less<CFBookmarkDataItem const*>, std::__1::allocator<CFBookmarkDataItem const*>>&, unsigned long) const + 1780 8 CoreServicesInternal 0x7ff81038df1f BookmarkData::copyDataItemAtOffset(unsigned int, unsigned long) const + 59 9 CoreServicesInternal 0x7ff81036f0dd BookmarkCopyPropertyFromBookmarkData(BookmarkData&, __CFString const*, unsigned long) + 154 10 CoreServicesInternal 0x7ff81036ecc0 _CFURLCreateResourcePropertiesForKeysFromBookmarkData + 242 11 CoreFoundation 0x7ff80cf71893 +[NSURL resourceValuesForKeys:fromBookmarkData:] + 25 12 LaunchServices 0x7ff80d3bf8f9 +[FSNode(BookmarkData) getName:fileIdentifier:creationDate:forBookmarkData:error:] + 205 13 LaunchServices 0x7ff80d3bf0fb _LSAliasCompareToNode + 353 14 LaunchServices 0x7ff80d47e3ce _LSAliasAndInodeOnContainerMatchesNode + 173 15 LaunchServices 0x7ff80d4505d3 _LSBundleMatchesNode(_LSDatabase*, unsigned int, LSBundleData const*, id, unsigned long long) + 97 16 LaunchServices 0x7ff80d3bee21 ___LSBundleFindWithNode_block_invoke + 33 17 LaunchServices 0x7ff80d3bec64 LaunchServices::BindingEvaluation::isBindingOK(LaunchServices::BindingEvaluation::State&, LaunchServices::BindingEvaluation::ExtendedBinding const&) + 165 18 LaunchServices 0x7ff80d3bbf31 LaunchServices::BindingEvaluation::addAndEvaluate(LaunchServices::BindingEvaluation::State&, void ()(LaunchServices::BindingEvaluation::State&), std::__1::vector<LaunchServices::BindingEvaluation::ExtendedBinding, std::__1::allocatorLaunchServices::BindingEvaluation::ExtendedBinding>&) + 4127 19 LaunchServices 0x7ff80d3ba6d3 LaunchServices::BindingEvaluation::runEvaluator(LaunchServices::BindingEvaluation::State&, NSError __autoreleasing*) + 1021 20 LaunchServices 0x7ff80d44bdb4 LaunchServices::BindingEvaluator::getBestBinding(LSContext*, UTTypeRecord* __strong*, NSError* __autoreleasing*) const + 138 21 LaunchServices 0x7ff80d3b9d75 LaunchServices::BindingEvaluator::getBestBinding(LSContext*, NSError* __autoreleasing*) const + 19 22 LaunchServices 0x7ff80d3b94a6 _LSBundleFindWithNode + 586 23 LaunchServices 0x7ff80d3b8a02 _LSFindOrRegisterBundleNode + 228 24 LaunchServices 0x7ff80d58b86a LaunchServices::URLPropertyProvider::capabilityEffectiveNodeForNode(LaunchServices::Database::Context&, FSNode*) + 279 25 LaunchServices 0x7ff80d58a4d7 LaunchServices::URLPropertyProvider::prepareApplicationCapabilityValue(LaunchServices::Database::Context&, id, __FileCache*, __CFString const*, LaunchServices::URLPropertyProvider::State*, NSError* __autoreleasing*) + 226 26 LaunchServices 0x7ff80d3b4e09 LaunchServices::URLPropertyProvider::prepareValues(__CFURL const*, __FileCache*, __CFString const* const*, void const**, long, void const*, __CFError**) + 772 27 CoreServicesInternal 0x7ff81036c057 prepareValuesForBitmap(__CFURL const*, __FileCache*, _FilePropertyBitmap*, __CFError**) + 380 28 CoreServicesInternal 0x7ff8103687cb _FSURLCopyResourcePropertyForKeyInternal(__CFURL const*, __CFString const*, void*, void*, __CFError**, unsigned char) + 266 29 CoreFoundation 0x7ff80cf5c54d CFURLCopyResourcePropertyForKey + 96 30 CoreFoundation 0x7ff80cf5bbca ____CFRunLoopSetOptionsReason_block_invoke_5 + 168 31 libdispatch.dylib 0x7ff80cd09ac6 _dispatch_call_block_and_release + 12 32 libdispatch.dylib 0x7ff80cd0adbc _dispatch_client_callout + 8 33 libdispatch.dylib 0x7ff80cd1a359 _dispatch_root_queue_drain + 1014 34 libdispatch.dylib 0x7ff80cd1a84f _dispatch_worker_thread2 + 152 35 libsystem_pthread.dylib 0x7ff80cea8b43 _pthread_wqthread + 262 36 libsystem_pthread.dylib 0x7ff80cea7acf start_wqthread + 15 The script is executed in the main thread of the application and the process itself does nothing more than launch this script, it is not performing any other tasks apart from recording logs of the script task. Also comment that this error has been seen on Mac machines with rosetta and the compilation of our product is on x86_64 architecture. And to say, if we are using applescript instead of the API it is because the compilation machine uses a Mac Catalina to compile it and we found it convenient to use applescript Any ideas why these errors may occur? Thanks
2
0
438
Jul ’24