I have a C++/Objective-C command line application, running on MacOs (15.1.1 (24B91)), that communicates with a Bluetooth LE peripheral. The application is build with Apple clang 16.0.0 and CMake as build system using Boost.Asio.
I'm able to establish a L2CAP channel and after the channel is established, the peripheral sends a first (quite small) SDU on that channel to the application. The PSM is 0x80 and was chosen by the peripherals BLE stack. The application receives the PSM via GATT notification.
I can see the SDU being send in a single LL PDU with Wireshark. I can also see the SDU being received in Apples PacketLogger. But I miss the corresponding call to a stream event handler. For all other GATT related events, the corresponding delegates / callbacks are called.
The code that creates a dispatch queue and passes it to the CBCentralManager looks like this:
dispatch_queue = dispatch_queue_create("de.torrox.ble_event_queue", NULL);
manager = [[CBCentralManager alloc] initWithDelegate:self queue:dispatch_queue options:nil];
When the L2CAP channel is established, the didOpenL2CAPChannel callback gets called from a thread within the dispatch_queue (has been verified with lldb):
- (void)peripheral:(CBPeripheral *)peripheral
didOpenL2CAPChannel:(CBL2CAPChannel *)channel
error:(NSError *)error
{
[channel inputStream].delegate = self;
[channel outputStream].delegate = self;
[[channel inputStream] scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[[channel outputStream] scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[[channel inputStream] open];
[[channel outputStream] open];
...
// a reference to the channel is stored in the outside channel object
[channel retain];
...
}
Yet, not a single stream event is generated:
- (void)stream:(NSStream *)stream
handleEvent:(NSStreamEvent)event_code
{
Log( @"stream:handleEvent %@, %lu", stream, event_code );
...
}
When I add a functionality, to poll the input stream, the stream will report the expected L2CAP input. But no event is generated.
The main thread of execution is usually blocking on a boost::asio::io_context::run() call. The design is, to have the stream callback stream:handleEvent to post call back invocations on that io_context, and thus to wake up the main thread and get that callbacks being invoked on the main thread.
All asynchronous GATT delegate calls are working as expected. The only missing events, are the events from the L2CAP streams. The same code worked in an older project on an older version of MacOs and an older version of Boost.
How can I find out, why the stream delegates are not called?
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
I am the Lead iOS Developer for The Incc, an upcoming social networking application. The platform offers subscriptions that grant users access to premium content, primarily digital magazines showcasing diverse cultures, alongside standard social media features and additional unique functionalities.
I am exploring two specific use cases for our subscription model.
Promo Codes with Split Payments:
We plan to collaborate with the our influencers (referred to as Mover Shakers) by providing them with promo codes for users to purchase subscriptions. For such purchases, we aim to implement a revenue split model, allocating 10% to the influencer and the remainder to us after Apple’s fees.
Gifting Subscriptions:
We also wish to enable users to gift subscriptions to others within the app.
I understand that the Apple Subscription Service does not natively support these features.
What other options do we have to achieve this that are also not against the Apple's guidelines.
I have a app with two targets: a main DeviceActivityApp target and a DeviceReport target. In the DeviceReport target, I have a TotalActivityReport struct conforming to DeviceActivityReportScene. Inside its makeConfiguration method, I update a dynamically generated list of AppReport items. The list updates correctly in the DeviceReport target.
// Define which context your scene will represent.
let context: DeviceActivityReport.Context = .totalActivity
// Define the custom configuration and the resulting view for this report.
let content: (MonitorDeviceReport) -> TotalActivityViewFirst
@ObservedObject var activityData:ActivityData
func makeConfiguration(representing data: DeviceActivityResults<DeviceActivityData>) async -> MonitorDeviceReport {
// Reformat the data into a configuration that can be used to create
// the report's view.
var appList:[AppsReport]=[]
let totalActivityDuration = await data.flatMap { $0.activitySegments }.reduce(0, {
$0 + $1.totalActivityDuration
})
for await _data in data{
for await activity in _data.activitySegments{
for await category in activity.categories{
for await app in category.applications{
let name=app.application.localizedDisplayName ?? "No Name"
let bundleId=app.application.bundleIdentifier ?? "nil"
let duration=app.totalActivityDuration
let appIcon=app.application.token
let app=AppsReport(id:bundleId,duration:duration, name:name, icon:appIcon)
appList.append(app)
}
}
}
}
DispatchQueue.main.async {
activityData.list=appList
}
return MonitorDeviceReport(duration:totalActivityDuration, apps:appList)
}
}
public class ActivityData:ObservableObject{
@Published var list:[AppsReport]=[]
public static let shared = ActivityData()
}. // This is in MonitorReport target
However, I need to access this dynamic list in my MyApp target, specifically in ContentView.swift. I tried using an ObservableObject (ActivityData) to share the data between targets, but the list always appears empty in the MyApp target.
Here’s what I’ve tried so far:
Created a shared ActivityData instance using @Published
Passed the ActivityData instance to TotalActivityReport
Used dependency injection and a singleton pattern for ActivityData
Verified that makeConfiguration updates the list correctly in DeviceReport
What could I be missing? How can I correctly share and access this data across targets?
Hello!
It's my first time posting in this forum. Apple Intelligence is enabled by default in Workspace ONE (WS1). I was wondering if Apple Intelligence can access or process corporate data within (WS1) corporate apps, which are containerized?
Thank you!
Topic:
App & System Services
SubTopic:
General
Hello,
I am currently developing an iOS application that leverages FinanceKit to access transaction history. I have already enabled FinanceKit in my developer account, but I am encountering challenges when trying to test the transaction history feature.
Could anyone guide me on the best practices or specific steps needed to effectively test FinanceKit’s transaction history in a development environment? Any insights on mock data handling, API responses, or potential limitations during testing would be greatly appreciated.
Thank you in advance for your help!
The support URL provided in App Store Connect must direct to a support page with links to a loan services privacy policy. The support page must also reference the lender or lending license.
The privacy policy provided in App Store Connect must include references to the lender.
The verified email domains associated with your Apple Developer Program account must match domains for the submitting company or partnered financial institution.
Topic:
App & System Services
SubTopic:
Processes & Concurrency
Anne has two phone numbers, work and personal. Beth saved both phone numbers for Anne under one contact profile. When Beth sends a text to Anne's work phone, it is received on Anne's personal phone instead.
We have verified only one phone number is set up under Messages settings, signed out of messages, restarted the phones.
Any other fixes or suggestions?
Hello, Apple App Store Server API Team!
I have one questions about the identifiers provided by Apple App Store Server API. Could you please answer?
We are running an iOS App. In our app, the transactionId we get from Apple App Store Server API is called T1. (Example)
Q1. Is it correct that other iOS apps cannot get T1 for transactionId from Apple App Store Server API? (I'm wondering if the transactionId is globally unique across apps.)
Thank you!
Topic:
App & System Services
SubTopic:
StoreKit
Tags:
Subscriptions
StoreKit
In-App Purchase
App Store Server API
I have an app and widget that share access to a SwiftData container using App Groups. I have implemented a SwiftData migration plan, but I am unsure whether I should allow the widget to perform the migration (in addition to the app). I am concerned about two possible issues:
If the app and widget are run at approximately the same time (e.g. the user taps Open after doing a manual update in the App Store), then both the app and widget might try to perform the migration at the same time, which could lead to race conditions / data corruption.
If the widget is first to run but the widget gets suspended for some reasons (e.g., iOS decides it's using too many resources), then the migration might be suspended leaving the database in an corrupted state.
To me, it feels like the safest option is to only allow the app itself to perform the migration – this will ensure that the migration can only happen once in a safe state. However, this will lead to problems for the widget. For example, if the user does not open the app for several days after an automatic update, the widget will be in a broken state, since it will not be able to open the container until it has been migrated by the app.
Possible solutions I'm considering:
Allow both the app and widget to perform the migration and cross my fingers. (Ignore Issue 1 and Issue 2)
Implement some kind of UserDefaults flag that is set to true during migration, so that the app and widget will avoid performing the migration concurrently. (Solves Issue 1 but not Issue 2)
Only perform the migration in the app, and then add code to the widget to detect which container version the widget has access to, so that the widget can continue to work with a v1 container until the app eventually updates it to a v2 container. (Solves Issue 1 and Issue 2, but leads to very convoluted code – especially over time)
Things I'm unsure about:
Will iOS continue to use v1 of the widget until the app is opened for the first time, at which point v2 of the widget is installed? Or does iOS immediately update the widget to v2 on update? Does iOS immediately refresh the widget timeline on update?
Does SwiftData already have some logic to avoid migrations being performed twice, even from different threads? If so, how does it respond if one process tries to access a container while another process is performing a migration?
Does anyone have any recommendations about how to handle these possible issues? What are best practices?
Cheers!
Hi guys,
In WWDC23 session 10016: Build custom workouts with WorkoutKit , the presenters mentioned that a Workout Plan can be exported to a JSON or binary file, and also showed a code snip:
let binaryRepresentation = try myCyclingWorkout.dataRepresentation(in: .compactBinary)
However in the current SDK, the property dataRepresentation can not be exported with a specific format, the base64EncodedString() result is unreadable.
Does anyone know how to export it as a JSON string now? Thanks very much.
Hi,
I want to develop the fastest payment method for my user and preferably without the user also having a mobile app.
The dream is that it happens as easily as possible when the user/guest scans a pass from the wallet.
Hopefully the user just has to approve on the screen.
Can I attach card details/payment methods to a pass in the wallet?
Right now it is a unique QR code for each user, but can I change the pass type to 'tansit', 'loyalty' or 'membership'?
My system right now:
The customer/guest registers on a website and creates a pass and downloads it to the wallet.
The store has a PWA app to scan the customer's/guest's items.
My goal: The guest just scans the pass in the wallet and makes the transaction. Dont need an app or go back to the website/login where the person created the pass for the wallet.
Topic:
App & System Services
SubTopic:
Apple Pay
Tags:
Wallet
Apple Pay on the Web
Apple Pay
Tap to Pay on iPhone
Hello, I am currently optimizing the performance of my application. I would like to obtain information about users being killed after leaving the application in the background, in order to evaluate whether the application is running normally in the background. I noticed that there is a Background Termination information in Xcode ->Organizer that records background exits. I would like to know the rules for obtaining this information and what is the health standard for this indicator on the Apple side?
I am developing a USB networking accessory using the CDC ECM or NCM protocol and I would like to know what are the MacOS and iPadOS requirements to connect to such a device.
I have a prototype CDC ECM device developed that uses static IPv4 addressing which I can connect to an Arch Linux host and ping, but I am unable to have the same success from my Mac Studio M1 running Sequoia 15.1.1. The device shows up under 'Other Services' with 'Not connected' status, whether I leave it with the default settings or change it to 'Configure IPv4 -> Manually' and then set the appropriate IP address / Subnet mask / Router.
From a discussion on Github, it seems that the ECM device must support NetworkConnection notification in order to work with MacOS. Can you point me to where this is documented and whether there are other expectations/requirements around USB network adapters?
My end goal is to make an embedded device that communicates to MacOS and iPadOS devices/apps over USB CDC NCM with a simple UDP socket listener.
Thank you in advance for any help you can provide.
我们项目使用了Appclip。之前默认轻App是可以正常打开的。但是最近发现在ios18系统及以上的时候,不能打开Appclip,而是跳转到safari浏览器中。请问该如何设置,可以在ios18以上系统中正常打开默认的Appclip?
Topic:
App & System Services
SubTopic:
General
I am getting this error when trying to run the app on an actual IOS device using testFlight. It works well on simulators. I am using expo to build my app. I have done the following:
Added Sign in with Apple in Xcode for all the profiles ( i.e. debug and release)
Set expo.ios.usesAppleSignIn to true in my app.json ( I think due to this I see Synced capabilities: Enabled: Sign In with Apple while building my app using eas build. )
Make sure that the provision profile has Sign in with App capability.
What I am not able to understand is how option provided in provision profile works. Expo creates the profile with type "App Store". I think this is because I am building the expo app with production profile. Does this have to take anything with it? Does the profile with type "App Store" not work when I am testing the app using testFlight? I am so confused right now. Can someone help me figure out the actual issue?
I have seen almost all the posts regarding this error. None of those helped!
Thanks in advance!
Topic:
App & System Services
SubTopic:
General
Hello,
I am encountering an issue with user-generated files stored in the Documents directory on an iPhone 11 running iOS 18.2.
The problem occurs as follows:
1.The app generates and saves files in the Documents directory using FileManager.
2.These files are successfully saved and remain accessible while the app is running.
3.After restarting the app, the files appear to have been deleted from the Documents directory.
I have confirmed that:
1.The files are being saved to the correct location (Documents directory) and can be accessed during the current app session and from iExplorer.
2.The app is not explicitly deleting these files during shutdown or restart.
3.This behavior is consistent across multiple app restarts.
I recently used Open core legacy patcher to update my old 2012 Macbook pro to run a new pice of dj software. the update went smooth but now the Dj software wont open just gives me a crash report. Im totally stumped.
the crash report.
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 4 Illegal instruction: 4
Terminating Process: exc handler [3839]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 Engine DJ 0x10c9e3d81 0x10c28f000 + 7687553
1 dyld 0x7ff807632729 invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 241
2 dyld 0x7ff80766b34e invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 133
3 dyld 0x7ff80765fb73 invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 543
4 dyld 0x7ff80761a07b dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 249
5 dyld 0x7ff80765ebe8 dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 176
6 dyld 0x7ff807661266 dyld3::MachOFile::forEachInitializerPointerSection(Diagnostics&, void (unsigned int, unsigned int, bool&) block_pointer) const + 116
7 dyld 0x7ff80766b084 dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 390
8 dyld 0x7ff8076325c2 dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 150
9 dyld 0x7ff807638af7 dyld4::JustInTimeLoader::runInitializers(dyld4::RuntimeState&) const + 21
10 dyld 0x7ff807632928 dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&, dyld3::Array<dyld4::Loader const*>&) const + 276
11 dyld 0x7ff807636141 dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const::$_0::operator()() const + 147
12 dyld 0x7ff8076329bc dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 90
13 dyld 0x7ff80764e1f7 dyld4::APIs::runAllInitializersForMain() + 277
14 dyld 0x7ff80761f52e dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3433
15 dyld 0x7ff80761e792 dyld4::start(dyld4::KernelArgs*, void*, void*)::$_0::operator()() const + 572
16 dyld 0x7ff80761e27f start + 1727
Thread 1:
0 libsystem_pthread.dylib 0x7ff8079a8bcc start_wqthread + 0
Thread 2:
0 libsystem_pthread.dylib 0x7ff8079a8bcc start_wqthread + 0
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00006000012acc80 rbx: 0x00006000032b3c90 rcx: 0x00006000012acd00 rdx: 0x000000011008e000
rdi: 0x0000000000000000 rsi: 0x00006000012ac000 rbp: 0x00007ff7b3c5a9f0 rsp: 0x00007ff7b3c5a9c0
r8: 0x0000000000000002 r9: 0x000000000000001b r10: 0x00000000001ff800 r11: 0x0000000000000080
r12: 0x000000010eeae278 r13: 0x000000010c28f6e8 r14: 0x00007ff84a461050 r15: 0x00007ff84a4614a0
rip: 0x000000010c9e3d81 rfl: 0x0000000000010207 cr2: 0x0000000000000000
Logical CPU: 2
Error Code: 0x00000000
Trap Number: 6
Topic:
App & System Services
SubTopic:
General
i never imagined that an apple product could do such. a thing . i 've updated to the latest version , 15.3 what should i do next time? i've had to restart it three times, the last one finally helped
here is the link https://youtu.be/-aqjzVKMZGA
Hi, I am trying to build a command line app that read local mov files and print the text to the terminal. When I open the file with VNImageRequestHandler(url: url), where the url is a hardcode path to my desktop file, the terminal reports CRImage Reader Detector was given zero-dimensioned image (0 x 0). Anyone can help? Thanks!
Topic:
App & System Services
SubTopic:
General
Tags:
Files and Storage
App Sandbox
Command Line Tools
I have a UIApplicationDelegate, where I want to terminate a live activity (in dynamic island) in applicationWillTerminate. However, ending an activity is asynchronous. When I end it within a Task, it's never called.