Core Services

RSS for tag

Access and manage key operating system services using Core Services.

Core Services Documentation

Posts under Core Services tag

14 Posts
Sort by:
Post not yet marked as solved
0 Replies
19 Views
I am using NetFS's NetFSMountURLAsync api to mount SMB share in mac os app. I am able to mount the share however this share is not automatically appearing in Finder's sidebar. I tried using LSSharedFileListInsertItemURL to make the mount point available in Finder's side bar however facing crash on line, kLSSharedFileListItemBeforeFirst.takeRetainedValue() from below code snippet. let itemType: CFString = kLSSharedFileListFavoriteItems.takeRetainedValue() if let list: LSSharedFileList = LSSharedFileListCreate(nil, itemType, nil)?.takeRetainedValue() { let inPropertiesToSet: CFMutableDictionary = CFDictionaryCreateMutable(nil, 1, nil, nil) CFDictionaryAddValue(inPropertiesToSet, unsafeBitCast(kLSSharedFileListVolumesNetworkVisible, to: UnsafeRawPointer.self), unsafeBitCast(kCFBooleanTrue, to: UnsafeRawPointer.self)) let driveUrl = URL(fileURLWithPath: mountPoint) let shareUrl: CFURL = driveUrl as CFURL if let item: LSSharedFileListItem = LSSharedFileListInsertItemURL( list, kLSSharedFileListItemBeforeFirst.takeRetainedValue(), nil, iconRef, shareUrl, inPropertiesToSet, nil) { let itemRefId = LSSharedFileListItemGetID(item) let itemRefIdStr = "\(itemRefId)" userDefaults.set(itemRefIdStr, forKey: mountPoint) } } Anything wrong in above code? Also since this api is deprecated is there any alternative API to achieve this. The goal is to make the mount point available in Finder's sidebar so that user can easily access it.
Posted
by apjoshi.
Last updated
.
Post not yet marked as solved
1 Replies
134 Views
Hi, I think the title says it: my application needs to obtain a list of all applications that are configured as potential editors of a certain file type, for example jpeg or tiff. I've found LSCopyAllRoleHandlersForContentType which appears to do what I need, but it is deprecated since macos 12.0. What's the modern alternative? My app is built in c++ with some objective-c. Thanks Joost
Posted
by joostn.
Last updated
.
Post not yet marked as solved
1 Replies
252 Views
Here's how my app used to work: On one device, generate a text file with a custom extension. Send it via AirDrop or in Messages to another device. Open the file in another copy of my app. The app processes the data correctly the way I want. Now, when I try to do this, I get this: Error Domain=NSCocoaErrorDomain Code=257 "The file “Shopping List.sld” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/Downloads/Shopping List.sld, NSUnderlyingError=0x282280a50 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}} file:///private/var/mobile/Library/Mobile%20Documents/com~apple~CloudDocs/Downloads/Shopping%20List.sld I think this broke with the iOS 17 upgrade. What permissions or capabilities do I need to add to my app to do that, and how do I go about adding them? I am quite new to xCode and iOS developement, but I had this working before.
Posted Last updated
.
Post not yet marked as solved
2 Replies
226 Views
While debugging my app in Xcode, my app calls SetFrontProcess which is returning an OSErr of -13066. What does -13066 mean? Possibly means "SetFrontProcess was deprecated in 10.9, why are you still using it?" But I thought I'd check.
Posted Last updated
.
Post marked as solved
3 Replies
415 Views
I have tried below code to open [Settings(App) -> Bluetooth Settings] but it is navigating to App permission screen instead of Bluetooth Settings. I have tried to search but didn't get any latest documentation regarding it. Is there any way to do this? guard let url = URL(string: UIApplication.openSettingsURLString) else { return } if UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionHandler: nil) }
Posted
by Kanuga_p.
Last updated
.
Post not yet marked as solved
0 Replies
343 Views
Hello Community, Need your help/guidance please. Seeking LocationServices experts who can advise me whether my idea for a valuable add-on feature that I've been trying to add into my app for 2+ months is achievable or not given LocationServices limitations. The Feature: to enable users who would like to be automatically notified whenever they're within X meters from a store that provides them an exclusive discount BUT only when they choose to be notified. Instruction to enjoy the feature is by keeping app open in 'background state' (means opened and kept in background) but not when app is terminated state (completely closed). The state is important because I would like to give users the choice to only receive notifications when they choose to instead of all-time. That is to eliminate unnecessary power consumption fetching location updates constantly when user don't need them (example staying at home, at work, etc), but give them option when they go out. Ideal scenario (after opting in to enable 'Always'): user launches the app, keeps in background, go out shopping/dining/etc and enjoy convenience of being automatically notified whenever about Xmeters from a place that they have an exclusive offer for. Implemented conditions: API is called at fixed time interval whenever user is within about 10 meters from their last location, that is to limit checking only when there is certainty user is within the same place for sometime instead of just walking by (this currently works perfectly, using AccuracyBest), the challenge when user terminates app, LocationServices wakes up again and continues to fetch location updates constantly. The Ask: Is it technically possible that I configure app LocationServices to not wake-up with [AccuracyBest] when terminated but instead use only reduced accuracy (like 'significant location updates' or on 'AccuracyOne/ThreeKilometer')? Ideas/suggestions/recommendations would be much much appreciated
Posted
by Ramroum92.
Last updated
.
Post not yet marked as solved
2 Replies
395 Views
Apple deprecated launch service calls like LSCopyAllRoleHandlersForContentType, referring to -[NSWorkspace URLsForApplicationsToOpenContentType:] instead. However all those new NSWorkspace methods do not have the crucial LSRolesMask the launch service calls have. For example, I have code that looks up all alternative shells, and with LSCopyAllRoleHandlersForContentType I could simply provide LSRoleMask.shell to restrict the returned bundle identifiers to shells only. This is not the first time Apple deprecates stuff without a proper replacement and I don't really get it. Every OS update is basically a downgrade. Or is there another way to replicate the old launch service call behavior?
Posted
by eaigner.
Last updated
.
Post not yet marked as solved
1 Replies
340 Views
Colleagues, I need your help. I have an swift app-widget and I wish users to have the ability to go to a certain IOS Settings screen, for example to "Display & Brightness". or Night Shift. So, when user taps on widget he will go to Display & Brightness settings screen. Tell me please, is it possible to adjust the code to work this way or does Apple policies not allow redirecting users to a certain screen in ios settings?
Posted
by Hemmi003.
Last updated
.
Post marked as solved
1 Replies
441 Views
I am trying to test an application in a SANDBOX environment. iPhone XR, iOS 17.0.3, Xcode 15.0.1 Everything works, but with every transaction or update I get a lot of CoreServise warnings, Error messages, etc.
Posted
by paulmax.
Last updated
.
Post not yet marked as solved
1 Replies
688 Views
xcode→Archive →result his bundle is invalid. The value of the CFBundleDocumentTypes key in the Info.plist must be an array of dictionaries, with each dictionary containing at least the CFBundleTypeName key. (ID: (something)) My Xcode versions 14 What do I this error? (I'm a Japanese.I'm sorry that it was hard to understand.)
Posted
by maro312.
Last updated
.
Post not yet marked as solved
2 Replies
1.2k Views
Dear Experts, I'm attempting to make a custom icon appear in the iOS Files app, etc., for my file type. I've found a couple of bits of documentation for Info.plist keys: https://developer.apple.com/documentation/bundleresources/information_property_list/utexportedtypedeclarations/uttypeiconfiles describes UTTypeIconFiles, to be included in UTImportedTypeDeclarations. This documentation is very sparse! Older document https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-SW9 describes CFBundleTypeIconFiles, to be included in CFBundleDocumentTypes. Which of these should I be using? (Both? Neither?) Nothing I've tried so far has worked. I wonder if I need to, for example, power-cycle to make the Files app pick up the new icons. Also, in Xcode, I've found the Imported Type Identifiers section of the Info settings which has a box labelled "Add imported type identifiers here" - but clicking + and choosing a file does nothing; the box remains empty. Anyone else have that problem? What size should the icons be? The older document suggests some rather small sizes, e.g. 22x29; the newer doc says nothing. Suggestions anyone?
Posted
by endecotp.
Last updated
.
Post not yet marked as solved
5 Replies
6.5k Views
This is my snippet code:if (([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0) { NSURL *URL = [NSURL URLWithString:@"App-prefs:root=Privacy&path=LOCATION"]; [[UIApplication sharedApplication] openURL:URL options:@{} completionHandler:nil]; }This code works fine for iOS 10.0 to 10.3.3 but when I run this code for iOS 11(beta), the application goes into the background but the Setting page doesn't get opened.
Posted Last updated
.
Post not yet marked as solved
6 Replies
22k Views
Hi All,I am facing one problem in my app.That is open wifi access settings from my app.It is working fine in iOS 9.3.2 and it's not working in iOS10.is it possible to make it workable in iOS10?If so How to do that?Please help me over this to resolve the problem.Thanks,Suneelkumar Biyyapu.
Posted Last updated
.
Post marked as solved
1 Replies
808 Views
I am testing with FSEventStreamCreate which returns an FSEventStreamRef, but I cannot find an equivalent toll-free class in Cocoa. In order to free-up resources used by this Ref, I need to do following: FSEventStreamStop(stream); FSEventStreamInvalidate(stream); FSEventStreamRelease(stream); That is quite error-prone and tedious. So I want to write a wrapper class, but don't have any idea on when or where to release the Ref. Is it correct to do 'free' in dealloc?
Posted
by imneo.
Last updated
.