I have an app that is used to control features of a device with a driverkit driver. I am having trouble creating a connection a certain device.
The Sample code from "Communicating between a DriverKit extension and a client app.
The sample code shows:
ret = IOServiceGetMatchingServices(kIOMainPortDefault, IOServiceNameMatching(kDextIdentifier), &iterator);
I cannot use kDextIdentifier but need to find a service with a certain BSD Name. So in this case I try:
ret = IOServiceGetMatchingServices(kIOMainPortDefault, IOBSDNameMatching(kIOMasterPortDefault, NULL, interface), &iterator);
In each case the call completes correctly, and we get an iterator. I can also use IOServiceGetMatchingService with IOBSDNameMatching, and that completes correctly as well.
However when I attempt IOServiceOpen with the first case, the connection is created correctly. However, I have four of these in the machine, and I need to select the service and subsequently connection for a certain BSD name.
When I attempt the IOServiceOpen with the second/third calls, the IOServiceOpen call fails with error 0x2c7 which is unsupported.
Is there an entitlement I need to make this work?
Delve 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
When i use Xcode16 Beta4, I finish some code
for example
@available(iOS 18.0, *)
struct Test001ControlWidget: ControlWidget {
let kind: String = "Test001ControlWidgetKind"
var body: some ControlWidgetConfiguration {
StaticControlConfiguration(kind: kind, content: {
ControlWidgetButton(action: Test001ControlAppIntent(), label: {
HStack {
Image("controlcenter_point")
Text("Test001")
}
})
})
.displayName("Test001")
}
}
@available(iOS 18.0, *)
struct Test001ControlAppIntent: AppIntent {
static let title: LocalizedStringResource = "Open Demo Some Page"
static var isDiscoverable: Bool = false
static var openAppWhenRun: Bool = true
func perform() async throws -> some IntentResult & OpensIntent {
let defaultIntent = OpenURLIntent()
guard let url = URL(string: Test001JumpType.sohuWatchPoint.jumpLink()) else { return .result(opensIntent: defaultIntent) }
return .result(opensIntent: OpenURLIntent(url))
}
}
The icon can be displayed normally and icon type is png.
And deep link also jump normally.(Note: The control widget file target membership are main app and widgetExtension)
But iOS18 RC code is no working and icon show "?"
How do I deal with these issues?
I hope to hear from you soon.
Tks a lot...
Hi! After upgrading my Macbook Pro M1 Pro to MacOS Sequoia 15.0 when I run my python backend code i show in dock all python process as Exec Icon. Now work with backend so hard, because all my dock in this icons( How I can fix this? Support dont help me, because resinstall and e t c dont work for me.
I am having an issue with scheduling daily background task (eg: nightly) when app is in terminated app state (user forcefully terminated the app from app switcher).
If the app is in suspended state, I am able to schedule a daily background task. But is there a way to wake up the app nightly and register a BGTask when user forcefully terminates the app.
Topic:
App & System Services
SubTopic:
Processes & Concurrency
Tags:
Background Tasks
Background Assets
Hi everybody!
With latest updates on Ventura around 13.9.X, Sonoma 14.5 and upper, and most probably Sequoia, we notice a change on how to retrieve BSSID. We know Airport is discontinue, but also other commands are impacted by new security policies.
Now, to make any command work in the proper way we need to ask for Location Permission. But here is where we are finding some issues to make it compatible with the new requirements.
We have a web desktop app (Built with Electronjs) that use an mach-o executable (built on C++). This executable runs IOREG to retrieve the BSSID. One of the tries we did is to request the Location Permission on the parent/GUI app, but by doing this, IOREG was not able to retrieve the BSSID.
Then, we try to look for a way to make a little test only with our executable. But in the attempt to, we do not found a way to trigger the location permission request, either manually or by a command.
Is there a way to prompt the user from a terminal executable or the right way is to prompt from the GUI?
Do we need to stop using Mach-o executable in c++ and move to a native mach-o executable in swift to be able to prompt from it (This executable runs in the machine frequently, several times per minute)?
We are open to change the command if need it.
Code I have used for years on Macs now crashes after updating OS:
SSL_CTX *sslctx = SSL_CTX_new(SSLv23_client_method());
Reading the posts about TLS changes, I change it to this:
SSL_CTX *sslctx = SSL_CTX_new(TLS_client_method());
In fact any method I give results in crash.. Is this a known issue?
Is there something I now need to call before calling SSL_CTX_new()?
Topic:
App & System Services
SubTopic:
Networking
please help, upgrade to Sequoia 15, system default open it, how to close?
how to turn off private WiFi address using code, swift or objective-c language
Topic:
App & System Services
SubTopic:
Networking
Bootstrapping failed for <FBApplicationProcess: 0x52ed3f180; app:> with error: <NSError: 0x3020c42a0; domain: RBSRequestErrorDomain; code: 5; "Launch failed."> {
NSUnderlyingError = <NSError: 0x3020c4630; domain: NSPOSIXErrorDomain; code: 85> {
NSLocalizedDescription = Launchd job spawn failed;
};
}
Topic:
App & System Services
SubTopic:
Core OS
I have a user who keeps crashing on his iOS 18 device, I need some help~
Exception 1, Code 26, Subcode 8 > Attempted to dereference garbage pointer 0x1a.
0
ImageIO IIOScanner::getVal32() + 36
1
ImageIO PSDReadPlugin::initialize(IIODictionary*) + 620
2
ImageIO PSDReadPlugin::initialize(IIODictionary*) + 620
3
ImageIO IIOReadPlugin::callInitialize() + 400
4
ImageIO IIO_Reader::initImageAtOffset(CGImagePlugin*, unsigned long, unsigned long, unsigned long) + 164
5
ImageIO IIOImageSource::makeImagePlus(unsigned long, IIODictionary*) + 832
6
ImageIO IIOImageSource::getPropertiesAtIndexInternal(unsigned long, IIODictionary*) + 72
7
ImageIO IIOImageSource::createThumbnailAtIndex(unsigned long, IIODictionary*, int*) + 1352
8
ImageIO CGImageSourceCreateThumbnailAtIndex + 740
9
Photos _createDecodedImageUsingImageIOWithFileUrlOrData + 856
10
Photos __91-[PHImageIODecoder decodeImageFromData:orFileURL:options:existingRequestHandle:completion:]_block_invoke_2 + 176
11
libdispatch.dylib _dispatch_call_block_and_release + 32
12
libdispatch.dylib _dispatch_client_callout + 20
13
libdispatch.dylib _dispatch_continuation_pop + 596
14
libdispatch.dylib _dispatch_async_redirect_invoke + 580
15
libdispatch.dylib _dispatch_root_queue_drain + 392
16
libdispatch.dylib _dispatch_worker_thread2 + 156
17
libsystem_pthread.dylib _pthread_wqthread + 228
Hi, I'm migrating ClockKit complications to WidgetKit. Everything works well except when I run the WidgetKit version, I see complications appear twice each in the complications list for my app when adding them.
If I restart the app from Xcode, it won't happen again, only for the first time. But on the actual device, only Watch restart or app reinstall fixes it which is frustrating and would not be ideal for live users.
I even tried Apple's example ClockKit project -> added complications to watch face -> added WidgetKit target, CLKComplicationWidgetMigrator and func widgetConfiguration(from complicationDescriptor: CLKComplicationDescriptor) code -> run the app -> new complications appear correctly replacing old ones -> when hold to add/change complications I see it doubled (screenshot attached) and it's even selected twice
If I add more complications, they will appear two times as well except one selected in two places almost like it's two same lists created.
class ComplicationController: NSObject, CLKComplicationDataSource, CLKComplicationWidgetMigrator {
@available(watchOSApplicationExtension 9.0, *)
var widgetMigrator: CLKComplicationWidgetMigrator {
self
}
@available(watchOSApplicationExtension 9.0, *)
func widgetConfiguration(from complicationDescriptor: CLKComplicationDescriptor) async -> CLKComplicationWidgetMigrationConfiguration? {
switch complicationDescriptor.identifier {
case "Coffee_Tracker_Caffeine_Dose":
return CLKComplicationStaticWidgetMigrationConfiguration(
kind: "WidgetKitComplications",
extensionBundleIdentifier: "com.example.apple-samplecode.Coffee-Tracker.watchkitapp.watchkitextension.WidgetKitComplications")
default:
return nil
}
}
Anyone who has successfully migrated to using WidgetKit for their Apple Watch complications, your help would be greatly appreciated!
I've migrated to WidgetKit for my Watch app. On the Apple Watch Face Editor, the new Widget names and options appear correctly.
However, on the iPhone Apple Watch app, it offers both WidgetKit and old ClockKit complications... this should not be.
I also have found rendering issues where Watch Faces on the main My Watch tab have blank gaps for WidgetKit complications, when selecting the Watch Face they then render (see photos)
I've put in a feedback FB12460375
Have tried a full clear and reinstall of my app on both devices, no change. This issue occurs on WatchOS 9.5.2 / iOS 16.5.1 and WatchOS 10 Beta 2 / iOS 17 Beta 2
Any other ideas?
If I run an app with a message filter extension on < iOS 18 everything is as expected, if I run the same app, without any changes on iOS 18 then it doesn't work.
I've discovered that problems occur if the extension has the following code:
extension MessageFilterExtension: ILMessageFilterQueryHandling, ILMessageFilterCapabilitiesQueryHandling {
func handle(_ capabilitiesQueryRequest: ILMessageFilterCapabilitiesQueryRequest, context: ILMessageFilterExtensionContext, completion: @escaping (ILMessageFilterCapabilitiesQueryResponse) -> Void) {
let response = ILMessageFilterCapabilitiesQueryResponse()
response.transactionalSubActions = [.transactionalCarrier, .transactionalHealth, .transactionalPublicServices, .transactionalFinance, .transactionalWeather, .transactionalRewards, .transactionalOrders, .transactionalOthers, .transactionalReminders]
response.transactionalSubActions = [.transactionalFinance,
.transactionalOrders,
.transactionalHealth]
completion(response)
}
This code doesn't run on iOS 18, however the following code does run on iOS 18:
let response = ILMessageFilterCapabilitiesQueryResponse()
completion(response)
I downloaded several apps from the app store which provide message filtering, within the Message app they all had one thing in common, on < iOS 18 they all show 12 filtering categories, but within iOS 18 they only show 2. So it seems the issue is endemic and effects other apps, not just mine.
In my app, I need a one-time location update, which I do with CLLocationManager’s requestLocation().
On iOS, it works fine, but on macOS Sequoia, the CLLocationManagerDelegate’s didUpdateLocations function is called indefinitely in the loop, until I call stopUpdatingLocation() on a manager. This should not be necessary unless I was calling startUpdatingLocation (which I am not), and seems like a newly introduced bug in Sequoia (or Xcode 16).
So, just a heads-up to everyone, it's necessary to call stopUpdatingLocation() after obtaining the location (or on error).
Hello,
Based on the application runtime logs, after switching to the background (possibly due to the user forcibly closing the application), the app sometimes restarts immediately or after several seconds and executes the didFinishLaunchingWithOptions method (at this point, UIApplicationState == UIApplicationStateBackground).
The application itself has not requested background permissions, as shown in the attachment. I am puzzled about what could cause the application to restart in the background several seconds after being forcibly closed.
Could you please help clarify the possible reasons for this behavior?
(We have considered if it might be due to prewarming, but there is no prewarm flag during the startup.)
Thank you.
I am developing a new App that uses Push Notifications. I completed the development of the App itself and I can send Push Notifications from the CloudKit and receive it on my phone.
My problem is sending the Push Notifications from our service API to Apple. If I use the production address gateway.push.apple.com, I can send messages, but they don't work for my new App because it is in development and not yet released. If I use the sandbox address api.sandbox.push.apple.com, I get the following exception:
System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it. [::ffff:17.188.143.98]:2195
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port)
--- End of stack trace from previous location ---
at System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port)
at System.Net.Sockets.Socket.Connect(String host, Int32 port)
at System.Net.Sockets.TcpClient.Connect(String hostname, Int32 port)
at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port)
The service API for sending Push Notifications was developed in C# .NET 8.0.
Constants:
private readonly string _hostname = "api.sandbox.push.apple.com";
private readonly int _port = 2195;
The code for sending a message.
public async Task Send(string? subtitle, string? title, string message, string deviceId)
{
var payload =
"{ \"aps\": { " +
"\"alert\": { " +
"\"title\": \"" + title + "\", " +
"\"subtitle\": \"" + subtitle + "\", " +
"\"body\": \"" + message + "\"" +
"} " +
"} " +
"}";
try
{
Debug.WriteLine($"apple api request: {payload}");
using var client = new TcpClient(_hostname, _port);
var sslStream = new SslStream(client.GetStream(), false, new RemoteCertificateValidationCallback(ValidateServerCertificate));
var certificatesCollection = new X509Certificate2Collection(_certificate);
await sslStream.AuthenticateAsClientAsync(_hostname, certificatesCollection, SslProtocols.Tls12 | SslProtocols.Tls13, true);
var array = DataToBytes(deviceId, payload);
sslStream.Write(array);
sslStream.Flush();
client.Close();
}
catch(Exception exception)
{
Debug.WriteLine(exception);
}
}
The certificate that is used in this code was read beforehand:
var clientCertificate = new X509Certificate2(iOSApp.Certificate, iOSApp.CertificatePassword);
We are using a p12 certificate file with a private password.
Again, it works great for an App in Production but not at all for an App in Development. I made use that I use a new p12 developer certificate for the new App when I tested. I also tested with a p12 production certificate. I get the same error.
Any help is appreciated.
I have an app that starts a Live Activity on a certain user action. This Live Activity contains a button that the user can tap, which updates a SwiftData model instance. However, when you return to the main app after tapping the button on the Live Activity, the views do not update to reflect the changes, even though the changes were written to the database.
The underlying issue here is that the ModelContainer/ModelContext used by the AppIntent (performed from the LiveActivity when the button is tapped), are different from the instances in the main app. Meaning that while the changes are written to the underlying storage, the in-memory instances of ModelContext/ModelContainer in the main app don't get the changes from the extension, so SwiftUI doesn't update either.
What is the recommended way to handle this scenario? Or is there one? :) Shared access to a SwiftData container is clearly supported through App Groups, so is there not a mechanism to ensure changes made by an extension are updated in real-time for the main app?
Otherwise, it seems I would have to go through and manually rerun queries that views depend on to make sure they are showing the most recent data. This is cumbersome and error-prone.
Perhaps I'm missing something? Any suggestions would be greatly appreciated.
Consider this code
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
init() {
let schema = Schema([
...
])
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
do {
sharedModelContainer = try ModelContainer(for: schema, configurations: [modelConfiguration])
} catch {
fatalError("Could not create ModelContainer: \(error)")
}
SettingsViewModel.shared = SettingsViewModel(modelContext: sharedModelContainer.mainContext)
}
I'm basically saving a copy of mainContext in a viewModel. And then later on uses that viewModel to operate on the models while using the mainActor.
Is this ok? That same container is also pass into the view using
.modelContainer(sharedModelContainer)
Can it be used in both ways like that?
Hey developers! I updated to Xcode 16 and iOS 18. I wanted to publish my first iOS 18 update but I keep getting a very strange error after building and launching the app: "Fatal error: This model instance was destroyed by calling ModelContext.reset and is no longer usable." (I haven't changed anything regarding swift data and I never call ModelContext.reset)
This error happens only after building. When I close the app and open it again (without running it through Xcode) the app never crashes and all the data is still there. I couldn't find much bout this error online. Is anyone experiencing the same?
I wonder if this is a bug in Xcode 16 or there is something wrong with my code. I also wonder if I can safely publish my update to App Store, since the error only happens after building. Thank you!
Currently, when on the phone, like Spotify, I fully close the Spotify app, and in Carplay, when the user clicks on the Spotify app, this app can open as normal. I also developed my app but when I open the app in carplay, it shows a white screen, and then the app auto-terminates (closes permanently). How Can I do the behavior like the Spotify app, My app also enabled background mode in xCode. Please help me. Thanks so much
Hi,
We are currently planning an app transfer between two developer accounts.
We are concerned about files stored in the app's documents surviving the first update of the app released with the new developer account.
Since app files in documents are part of the app's container, is it safe to assume that if the user just updates the app after the transfer, the files in documents would still be there? It is important for us to confirm this before we execute our plans
Also, our app currently uses iCloud containers to save another set of files. Are these transferred with the app transfer or will the app lose access to these files? Are the files however accessible by users' by looking for them on their iCloud Drive?
Thank you!
Topic:
App & System Services
SubTopic:
iCloud & Data