I have a dedicated render thread with a run loop that has a CADisplayLink added to it (that's the only input source attached). The render thread has this loop in it:
while (_continueRunLoop)
{
[runLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
}
I have some code to stop the render thread that sets _continueRunLoop to false in a block, and then does a pthread_join on the render thread:
[_renderThreadRunLoop performBlock:^{
self->_continueRunLoop = NO;
}];
pthread_join(_renderThread, NULL);
I have noticed recently (iOS 18?) that if the Display Link is paused or invalidated before trying to stop the loop then the pthread_join blocks forever and the render thread is still sitting in the runMode:beforeDate: method. If the display link is still active then it does exit the loop, but only after one more turn of the display link callback.
The most likely explanation I can think of is there has been a behaviour change to performBlock - I believe this used to "consume" a turn of the run loop, and exit the runMode:beforeDate call but now it happens without leaving that function.
I can't find specific mention in the docs of the expected behaviour for performBlock - just that other RunLoop input sources cause the run method to exit, and timer sources do not. Is it possible that the behaviour has changed here?
General
RSS for tagDelve 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.
Post
Replies
Boosts
Views
Activity
I have a PDF file with images, using pdfview.document DataRepresentation() converts PDF to Data format, and the background color of the images in the converted PDF turns black. This only occurs on iOS 18 iPad devices, and there is no such problem on iOS 17 iPad and iOS 18 iPhone
We want to support apple login in our application, and our domain has protection from public access, so we have followed document "Configuring your environment for Sign in with Apple" from Xcode ---> window --- > Developer Document to use ip connect to apple.
when we ping the ip list in the document, like:
17.32.139.128/27
17.32.139.160/27
17.140.126.0/27
17.140.126.32/27
17.179.144.128/27
17.179.144.160/27
17.179.144.192/27
17.179.144.224/27
17.253.0.0/16
but they have no response.
what's wrong with it? hope help!
I have my application named "TestDataPro" in apple store.
When I open the application and click on apple icon, my application crash.
It is working fine in MACOS version 14.2.1.
But it is causing crash in MACOS version 14.5 and 14.6 with having Apple M1 or M2 chip.
While for the same MACOS version with having intel chip it is working fine.
I have attached crash log. Can you please help me to find the root cause for this?
TDPCrashReport.txt
It is a very strange situation I am suffering now.
I am hosting thingsboard CE on AWS EC2 (443, 1883, 80 and 8080 port are opened), I can access the console GUI through domain name, public IP and my ESP32 device can register and report MQTT data, all the widgets everything work like a charm !
I can use Simulator (iPhone 16 Plus Max) to access the dashboard, widgets, alarms, devices and audit logs, and I can install the Runner on my iPhone 16 Plus Max through Xcode and the Runner works well as expected on the Simulator.
Whereas, when I created Testflight app, download and install the testing release in on my iPhone, I can access the GUI, see the dashboard, but after click the dashboard, all widgets cannot be loaded, thingsboard icon continues spinning ! The alarms, devices and audit logs on the Testflight app works well, no issues.
Did you ever experience such issue?
Thanks !
I was testing SFSpeechRecognition on my real device running ios 18.2 beta, and found that the result's "final" field is true, the result itself does not contain entire conversation's transcription. I came across some blog posts saying it's fixed in a 18.1 beta, is this not the case for 18.2 beta?
Example code:
recognitionTask = recognizer.recognitionTask(with: request) { [weak self] result, error in
guard let self = self else { return }
if let error = error {
DispatchQueue.main.async {
self.errorMessage = "Transcription failed: \(error.localizedDescription)"
self.isTranscribing = false
}
} else if let result = result, result.isFinal {
// HERE!
}
}
So I have a button on a widget styled as seen below. I want this button to take up the entirety of the width, problem is, when it does so either using a frame(maxWidth: .infinity) or if I increase the horizontal padding, the button still only gets clicked if the user taps near the buttons center. Otherwise, it will open the app.
Relevant code:
Button(intent: Intent_StartRest() ){
Text("stop")
}
.buttonStyle(PlainButtonStyle())
.tint(.clear)
.padding(.vertical, 6)
.padding(.horizontal, 100)
.background(RoundedRectangle(cornerRadius: 30).fill(.button))
.foregroundStyle(.buttonText) // Just sets text color
.useAppFont(size: 18, relativeTo: .caption, weight: .bold) // Just sets font
Any pointers?
I can't seem to find much documentation on the observe(_:options:changeHandler:) method itself. There is this page which has some example use, but there is no link to a 'real' documentation page for the method. Additionally the 'quick help' has a little bit of info, but no parameter definitions or explanation of if/how the return value or changeHandler closure are retained.
Hello,
We're facing an issue with app links failing and falling back to browser website journeys. Our apple-app-site-association file is hosted publicly and the app to app journeys have been working correctly up to very recently - we are trying to identify any potential network infra changes that could have impacted the Apple CDN being able to retrieve the apple-app-site-association file.
We can see in the iPhone OS logs that the links cannot be verified by the swcd process, and using the app-site-association.cdn-apple.com/a/v1 api via curl can also see the CDN has no record of the AASA file.
Due to the traffic being SSL and to a high volume enterprise site it is difficult for use to trace activity through anything other that the source IPs - we cannot filter on user-agent for "AASA-Bot/1.0.0" as breaking the SSL would be impactful due to the load. Is it possible to get a network range used by the Apple CDN to retrieve the AASA file as this would help us identify potential blocking behaviour?
Thank you.
I've created a font family, but Font Book refuses to include it in the English language set, despite my best efforts.
The font has every glyph in the OpenType "Std" set, plus several others.
I've checked various boxes for Latin 1 and Macintosh Character Codepages; plus Unicode ranges for Basic Latin, additional Latin, etc, etc.
I've compared it to several other fonts that are in the English set, and I can't see anything that they have that my fonts don't. (In fact, many of them seem to have much less!)
I've created other fonts that are in the English set, but I've no idea what the difference is.
Given that macOS relies on these Language sets, in order to hide the thousands of unnecessary fonts that are permanently installed in the OS, there ought to be some guidance on how to do this.
Relevant docs: https://developer.apple.com/documentation/widgetkit/timelinereloadpolicy
I don't understand how .atEnd and .after works and how they differ.
So here's what I want: I want to display my widget then update it in 5 seconds. Now I know these examples show that I can use the .after policy like so:
let timeline = Timeline(
entries:[entry],
policy: .after(nextUpdateDate) // 5 seconds after now
)
But from reading the docs, .atEnd means: "A policy that specifies that WidgetKit requests a new timeline after the last date in a timeline passes."
So why can't we do:
let timeline = Timeline(
entries:[entry1, entry2], // entry 2 has date 5 seconds after
policy: .atEnd
)
I tried this and it does not seem to work. When I say I tried, I just had an onAppear on my widget view to print out the entry dates, and the entry 5 seconds later never prints. So what does .atEnd actually do? What happens if we put .atEnd with 1 entry?
Hello everyone,
I've built a @CurrentValue property wrapper that mimics the behavior of @Published, allowing a property to publish values on "did set". I've also created my own assign(to:) implementation that works with @CurrentValue properties, allowing values to be assigned from a publisher to a @CurrentValue property.
However, I'm running into an issue. When I use this property wrapper with two classes and the source class (providing the publisher) is not stored as a property, the subscription is deallocated, and values are no longer forwarded.
Here's the property wrapper code:
@propertyWrapper
public struct CurrentValue<Value> {
/// A publisher for properties marked with the `@CurrentValue` attribute.
public struct Publisher: Combine.Publisher {
public typealias Output = Value
public typealias Failure = Never
/// A subscription that forwards the values from the CurrentValueSubject to the downstream subscriber
private class CurrentValueSubscription<S>: Subscription where S: Subscriber, S.Input == Output, S.Failure == Failure {
private var subscriber: S?
private var currentValueSubject: CurrentValueSubject<S.Input, S.Failure>?
private var cancellable: AnyCancellable?
init(subscriber: S, publisher: CurrentValue<Value>.Publisher) {
self.subscriber = subscriber
self.currentValueSubject = publisher.subject
}
func request(_ demand: Subscribers.Demand) {
var demand = demand
cancellable = currentValueSubject?.sink { [weak self] value in
// We'll continue to emit new values as long as there's demand
if let subscriber = self?.subscriber, demand > 0 {
demand -= 1
demand += subscriber.receive(value)
} else {
// If we have no demand, we'll cancel our subscription:
self?.subscriber?.receive(completion: .finished)
self?.cancel()
}
}
}
func cancel() {
cancellable = nil
subscriber = nil
currentValueSubject = nil
}
}
/// A subscription store that holds a reference to all the assign subscribers so we can cancel them when self is deallocated
fileprivate final class AssignSubscriptionStore {
fileprivate var cancellables: Set<AnyCancellable> = []
}
fileprivate let subject: CurrentValueSubject<Value, Never>
fileprivate let assignSubscriptionStore: AssignSubscriptionStore = .init()
fileprivate var value: Value {
get {
subject.value
}
nonmutating set {
subject.value = newValue
}
}
init(_ initialValue: Output) {
self.subject = .init(initialValue)
}
public func receive<S>(subscriber: S) where S: Subscriber, Failure == S.Failure, Output == S.Input {
let subscription = CurrentValueSubscription(subscriber: subscriber, publisher: self)
subscriber.receive(subscription: subscription)
}
}
public var wrappedValue: Value {
get { publisher.value }
nonmutating set { publisher.value = newValue }
}
public var projectedValue: Publisher {
get {
publisher
}
mutating set {
publisher = newValue
}
}
private var publisher: Publisher
public init(wrappedValue: Value) {
publisher = .init(wrappedValue)
}
}
/// A subscriber that receives values from an upstream publisher and assigns them to a downstream CurrentValue property.
private final class AssignSubscriber<Input>: Subscriber, Cancellable {
typealias Failure = Never
private var receivingSubject: CurrentValueSubject<Input, Never>?
private weak var assignSubscriberStore: CurrentValue<Input>.Publisher.AssignSubscriptionStore?
init(currentValue: CurrentValue<Input>.Publisher) {
self.receivingSubject = currentValue.subject
self.assignSubscriberStore = currentValue.assignSubscriptionStore
}
func receive(subscription: Subscription) {
// Hold a reference to the subscription in the downstream publisher
// so when it deallocates, the susbcription is automatically cancelled
assignSubscriberStore?.cancellables.insert(AnyCancellable(subscription))
subscription.request(.unlimited)
}
func receive(_ input: Input) -> Subscribers.Demand {
receivingSubject?.value = input
return .none
}
func receive(completion: Subscribers.Completion<Never>) {
// Nothing to do here
}
public func cancel() {
receivingSubject = nil
assignSubscriberStore = nil
}
}
public extension Publisher where Self.Failure == Never {
/// Assigns the output of the upstream publisher to a downstream CurrentValue property
/// - Parameter currentValue: The CurrentValue property to assign the values to
func assign(to currentValue: inout CurrentValue<Self.Output>.Publisher) {
let subscriber = AssignSubscriber(currentValue: currentValue)
self.subscribe(subscriber)
}
}
Here’s an example demonstrating the issue, where two classes are used: Source, which owns the @CurrentValue property, and Forwarder1, which subscribes to updates from Source:
final class Source {
@CurrentValue public private(set) var value: Int = 1
func update(value: Int) {
self.value = value
}
}
final class Forwarder1 {
@CurrentValue public private(set) var value: Int
init(source: Source) {
self.value = source.value
source.$value.dropFirst().assign(to: &$value)
// The source is not stored as a property, so the subscription deallocates
}
func update(value: Int) {
self.value = value
}
}
With this setup, if source isn’t retained as a property in Forwarder1, the subscription is deallocated prematurely, and value in Forwarder1 stops receiving updates from Source.
However, this doesn’t happen with @Published properties in Combine. Even if source isn’t retained, @Published subscriptions seem to stay active, propagating values as expected.
My Questions:
What does Combine do internally with @Published properties that prevents the subscription from being deallocated prematurely, even if the publisher source isn’t retained as a property?
Is there a recommended approach to address this in my custom property wrapper to achieve similar behavior, ensuring the subscription isn’t lost?
Any insights into Combine’s internals or suggestions on how to resolve this would be greatly appreciated. Thank you!
Several users have reported that my iOS Action and Share Extensions is not visible.
Now one of the TestFlight users has reported the same. Notice this user has been using the app for one year, so they know how to use it.
Doing FaceTime and them sharing the screen, we have tried:
Deleting app and downloading from App Store
Deleting app, turning device off (call was off) and turning it on, downloading from App Store
Deleting app, turning device off (call was off) and turning it on, downloading from TestFlight
They can open the app, they just do not see the extensions. I would have thought it was the activation rules inside of the InfoPlist, but they are the same for all users and my other testers are not facing the issue.
Device is iPhone 16 Pro, iOS 18.1
What other steps could I follow? What other information could I gather to fix this?
My requirement is to open a specific screen of my app with when user says " Start Sleep meditation for 10 minutes" where Sleep and 10 minutes are dynamic values in the phrase. Is it possible just with a phrase we can get the values. Or do i need to ask using siri "which meditation" and then "how much tine". I am planning to use AppIntent and AppShortcut, along with Entities. But unable to open the shortcut when siri invokes with phrase i discussed above.
Hello
In the past, the documentation and specifically design guidelines were quite clear about the fact that having an exit button was not a good thing, and programmatically exiting the app was prohibited and ground to rejection by the review team.
Looking though the documentation and guidelines nowadays, I cannot find any explicit mention of this. We have a client that want us to add such button on the main menu of an app, and we are looking to hard evidence that this is against standards.
Has Apple stance on this changed ? Or have I missed it in the doc somewhere ?
We are developing remote desktop app on macOS and recently got user's report about unexpected app crash on macOS 15.2 beta.
On macOS 15.2, there's strange app crash on NSDictionary extension method.
We have narrowed down the steps and create the sample code to duplicate this issue.
Create a cocoa app project in objective-c
Try to access [NSNull null] value in NSDictionary
Use specific method name for NSDictionary extension - (long long)longLongValueForKey:(NSString*)key withDefault:(long long)defaultValue;
The console output for the example app is like below, the method pointer seems to be wrong when trying to get value with longLongValueForKey:withDefault: method to a [NSNull null] object.
********* longLongValueForKey: a: 0
********* longLongValueForKey: b: 100
********* longLongValueForKey: c: 0
********* longLongValueForKey:withDefault: a: -1
********* longLongValueForKey:withDefault: b: 100
********* exception: -[NSNull longLongValue]: unrecognized selector sent to instance 0x7ff8528d9760
********* longLongValueForKey:withDefault1: a: -1
********* longLongValueForKey:withDefault1: b: 100
********* longLongValueForKey:withDefault1: c: -1
Please create an objective-c app project and add below code to reproduce this issue.
//
// AppDelegate.m
// DictionaryTest
//
// Created by splashtop on 2024/11/13.
//
#import "AppDelegate.h"
#define IsNullObject(id) ((!id) || [id isKindOfClass:[NSNull class]])
@interface NSDictionary (extension)
(long long)longLongValueForKey:(NSString*)key;
(long long)longLongValueForKey:(NSString*)key withDefault:(long long)defaultValue;
(long long)longLongValueForKey:(NSString*)key withDefault1:(long long)defaultValue;
@end
@interface AppDelegate ()
@property (strong) IBOutlet NSWindow *window;
@end
@implementation AppDelegate
(void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
NSDictionary* dict = @{
@"b" : @(100),
@"c" : [NSNull null],
};
@try {
long long a = [dict longLongValueForKey:@"a"];
NSLog(@"********* longLongValueForKey: a: %lld", a);
long long b = [dict longLongValueForKey:@"b"];
NSLog(@"********* longLongValueForKey: b: %lld", b);
long long c = [dict longLongValueForKey:@"c"];
NSLog(@"********* longLongValueForKey: c: %lld", c);
}
@catch(NSException* e) {
NSLog(@"********* exception: %@", e);
}
@try {
long long a = [dict longLongValueForKey:@"a" withDefault:-1];
NSLog(@"********* longLongValueForKey:withDefault: a: %lld", a);
long long b = [dict longLongValueForKey:@"b" withDefault:-1];
NSLog(@"********* longLongValueForKey:withDefault: b: %lld", b);
long long c = [dict longLongValueForKey:@"c" withDefault:-1];
NSLog(@"********* longLongValueForKey:withDefault: c: %lld", c);
}
@catch(NSException* e) {
NSLog(@"********* exception: %@", e);
}
@try {
long long a = [dict longLongValueForKey:@"a" withDefault1:-1];
NSLog(@"********* longLongValueForKey:withDefault1: a: %lld", a);
long long b = [dict longLongValueForKey:@"b" withDefault1:-1];
NSLog(@"********* longLongValueForKey:withDefault1: b: %lld", b);
long long c = [dict longLongValueForKey:@"c" withDefault1:-1];
NSLog(@"********* longLongValueForKey:withDefault1: c: %lld", c);
}
@catch(NSException* e) {
NSLog(@"********* exception: %@", e);
}
}
@end
@implementation NSDictionary (extension)
(long long)longLongValueForKey:(NSString*)key {
long long defaultValue = 0;
id value = [self objectForKey:key];
if (IsNullObject(value) || value == [NSNull null]) {
return defaultValue;
}
if ([value isKindOfClass:[NSNumber class]] || [value isKindOfClass:[NSString class]]) {
return [value longLongValue];
}
return defaultValue;
}
(long long)longLongValueForKey:(NSString*)key withDefault:(long long)defaultValue {
id value = [self objectForKey:key];
if (IsNullObject(value) || value == [NSNull null]) {
return defaultValue;
}
if ([value isKindOfClass:[NSNumber class]] || [value isKindOfClass:[NSString class]]) {
return [value longLongValue];
}
return defaultValue;
}
(long long)longLongValueForKey:(NSString*)key withDefault1:(long long)defaultValue {
id value = [self objectForKey:key];
if (IsNullObject(value) || value == [NSNull null]) {
return defaultValue;
}
if ([value isKindOfClass:[NSNumber class]] || [value isKindOfClass:[NSString class]]) {
return [value longLongValue];
}
return defaultValue;
}
@end
I'm curious if anyone else has figured out why an intent defined in the intents file never seems to appear in the Shortcuts app on MacOS.
I'm following the steps outlined in "Meet Shortcuts for MacOS" from WWDC 2021.
https://developer.apple.com/videos/play/wwdc2021/10232
I build and run my app, launch Shortcuts, and the intent I defined refuses to show up!
There's one caveat - I allowed Xcode to update to 16.1, and mysteriously the intent became available in Shortcuts.app. When I went to add a second intent, I see the same as above - it simply never shows up in Shortcuts.app.
I have a few intents I'd like to write/add, but this build/test cycle is really slowing me down.
This app is a completely fresh Swift-AppKit app, I've never archived it, so there shouldn't be more than one copy on disk. I have also cleaned the build folder, restarted Xcode, restarted Shortcuts, restarted my machine entirely...
Anyone see this before and find a workaround? Any advice on how to give Shortcuts.app a kick in the rear to try and find my second intent?
Hi!
Instead of using username/password authentication, I wanted to use a magic link to authenticate users of my app to simplify the process.
However, on the app review, it got rejected because of the magic link:
Guideline 2.1 - Performance - App Completeness
Issue Description
The app exhibited one or more bugs that would negatively impact App Store users.
Bug description: The Magic Link failed to open the installed app.
Review device details:
- Device type: iPad Air (5th generation)
- OS version: iPadOS 18.1
Next Steps
Test the app on supported devices to identify and resolve bugs and stability issues before submitting for review.
If the bug cannot be reproduced, try the following:
- For new apps, uninstall all previous versions of the app from a device, then install and follow the steps to reproduce.
- For app updates, install the new version as an update to the previous version, then follow the steps to reproduce.
Resources
- For information about testing apps and preparing them for review, see Testing a Release Build.
- To learn about troubleshooting networking issues, see Networking Overview.
I had no luck to reproduce this.
The magic links trigger my application on all my testing devices.
I also had external testers using TestFlight and it works for all of them as well.
The only time where I can see it failing is if I archive the IPA and install it on an external service like AWS Device Farm or BrowserStack App Live. But here it is very hard to debug because I think I cannot get the sysdiagnose file and I don't know if it is even supposed to work in this case because those devices are not associated with my developer account.
I read countless links, tutorials and discussions on this topic but it did not really help.
https://developer.apple.com/documentation/technotes/tn3155-debugging-universal-links
https://developer.apple.com/documentation/xcode/allowing-apps-and-websites-to-link-to-your-content
Here is my set-up:
I added the Associated Domains capability to my app.
There under Domains I put applinks:subdomain.domain.com
Under https://subdomain.domain.com/apple-app-site-association and https://subdomain.domain.com/.well-known/apple-app-site-association I host this file with JSON content header:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "<TEAM>.<TestAppIdentifier>",
"paths": [
"/magiclink/*",
"/activate/*"
]
},
{
"appID": "<TEAM>.<Identifier>",
"paths": [
"/magiclink/*",
"/activate/*"
]
}
]
}
}
My main entry point of the app has a
.onOpenURL { url in
handleOpenURL(url)
}
on the ContentView()
If I go to https://app-site-association.cdn-apple.com/a/v1/subdomain.domain.com, I see the file correctly as I specified it above.
If I go on my development phone to Settings > Developers > Universal Links > Diagnostics and I enter one of the "magic links" into the field, it says with a checkmark Opens Installed Application.
https://getuniversal.link/ says my AASA file is valid.
Any suggestion on what I could do to further debug or resolve this is highly appreciated.
Hi,
I try to use NSUserDefaults to share some parameter values between the container app and the system extension. I have added the App Group in Signing & Capabilities in both apps. I set it in the container app and read it in the system extension app, but the information I read from the system extension is nil. I tested that I can read the information directly from the container app. Is the system extension running in the sandbox not allowed to read other app information? But the information I see should be OK, as shown below:
The container app code is as follows:
NSUserDefaults *sharedDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.yourcompany.shared"];
[sharedDefaults setObject:@"Sample Data" forKey:@"SharedData"];
[sharedDefaults synchronize];
The system expansion reading code is as follows:
NSUserDefaults *sharedDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.yourcompany.shared"];
NSString *data = [sharedDefaults objectForKey:@"SharedData"];
os_log_debug(logHandle, "NSUserDefaults: %{public}@", data);
I have an app with a shared internal framework, a main app target, and a widget target. In my shared framework, I have an AppIntent, FooIntent. In addition, I have an AppIntentPackage
public struct FooIntentsPackage: AppIntentsPackage { }
also in the framework. Finally, in the widget target, I reference that package:
struct FooAppIntents: AppIntentsPackage {
static var includedPackages: [any AppIntentsPackage.Type] { [ FooIntentsPackage.self ] }
}
However, when I run this, I get a bunch of these errors:
metadata `_$s8Internal15FooAppIntentsV' did not match any imported symbol.
I've tried turning off Strip Linked Product in both the Framework and the Widget, to no avail. Any ideas?