NSMutableAttributedString append NSTextAttachment , and set paragraphStyle.alignment = .justified, will Show Overlap,Word overlap。
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
Hello,
I created a lock screen widget for my app last year, as a widget app extension. It has worked fine, but I am working on a new release and it has stopped updating:
It is not called anymore when I call WidgetCenter.shared.reloadTimelines(ofKind: "MyWidget"), and the preview screen is now blank when I add it on the lockscreen.
I haven't touched anything related to the widget from what I know. The only things I can think of is that Xcode has updated my project files automagically, and I have updated cocoapods.
I looked at the device logs, and found this:
[...MyWidget] Failed to launch extension with error: Error Domain=com.apple.extensionKit.errorDomain Code=2 UserInfo={NSUnderlyingError=0x84b4d4410 {Error Domain=RBSRequestErrorDomain Code=5 UserInfo={NSLocalizedFailureReason=, NSUnderlyingError=0x84b45ea30 {Error Domain=NSPOSIXErrorDomain Code=111 UserInfo={NSLocalizedDescription=}}}}}.
I have no idea what this is, hoping someone can come up with suggestions on where to look. I have looked at my git history but I can't find anything changed.
Hi, I have purchased a developer program from apple and have received a confirmation email from apple but have yet to receive any feedback on the account. The email stated it would take 2 working days- it has now been 8 working days.
Can someone please help.
Since the recent update attachments to received emails are not showing.
The attachments clip icon shows they are there, but is unresponsive on click and grey.
If I forward the message it asks if I want to include the attachments, so they are there with certainty.
Does anyone know why as of last update this is happening ?
I have my app that works perfectly fine with app intents and shortcuts in the Shortcut app. I can find my shortcut when I look for my app in spotlight, the only thing that it are not displayed are the suggested entities, even if the param and suggested entities appear on my Shortcut app.
I call to the function updateAppShortcutParameters, and I see this error pop up.
Could anyone help me understand what I need to do to make it work?
Failed to refresh AppShortcut parameters with error: Error Domain=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=159, NSUnderlyingError=0x600005417540 {Error Domain=NSOSStatusErrorDomain Code=-10814 "Unable to find this application extension record in the Launch Services database." UserInfo={_LSFunction=_LSPluginFindWithPlatformInfo, _LSLine=679, NSDebugDescription=Unable to find this application extension record in the Launch Services database., SK=MyDemoAppBinary, IS=false}}, _LSFunction=+[LSBundleRecord bundleRecordWithBundleIdentifier:allowPlaceholder:error:]}
Can someone tell me what this is:
com.apple.axserver and requestor = universalaccess[417],
I'm trying to stop this I get 1000's per one minute:
023-11-21 20:49:20.763528 (gui/501 [100003]) : failed lookup: name = com.apple.axserver, handle = 1400, flags = 0x3, requestor = universalaccess[417], error = 3: No such process
I tried to find tags that relate but the tags window is so tiny that I cannot remember what I scrolled...... Also what about people who don't know how to associate a tag with their needs?
Thank you,
Dave
Hello,
i got the issues after upload my binary.
/**
ITMS-90626: Invalid Siri Support - Localized description for custom intent: '***' not found for locale: ar
ITMS-90626: Invalid Siri Support - Localized title for custom intent: '***' not found for locale: ar
*/
Actually, I didn't use Arabic.
Could someone tell me how to solve it?
How often/ under what circumstances are users sandbox directory URL's changed?
So I tried to save a URL to a document in @AppStorage
@AppStorage(DefaultsKey.userActiveBook.rawValue) var activeBook : URL = Bundle.main.url(forResource: "BookPlaceHolder", withExtension: "pdf")!
When user selects a new document activeBook is updated with the new URL.
Issue is when the app relaunches from xCode the path to whatever is stored in activeBook changes. My work around so far is to just access the users Documents Directory via FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!. Then appending the last path component of activeBook.
sidebar: obviously this doesn't work if the saved URL in activeBook is still the default from Bundle.main.url. I haven't written that workaround as yet.
Am I only seeing issues in development due to a fresh relaunch via xCode?
If the user only ever terminates the app on their device are the .documentDirectory URL's changing on each launch or do the remain constant?
I don't want to write a workaround to ensure the correct URL for whats stored in @AppStorage, if the changing URL's only occurs due to launching from xCode which the end user wont ever encounter that edge case.
Context
I'm using the NSFileCoordinator & NSFilePresenter in a sandboxed application to access SQLite database files and their secondary files (e.g. WAL or journal files) as per https://developer.apple.com/documentation/foundation/nsfilepresenter/1415415-primarypresenteditemurl
E.g. something similar to this:
var presenters: [NSFilePresenter] = ["wal", "journal", "shm"].map { ext in
let presenter = SQLiteTempFilePresenter(databaseId: databaseContext.id, sqliteMainFile: url, newExt: ext)
// addFilePresenter needs to be balanced with a `removeFilePresenter`. See SQLiteTempFilePresenter#deinit
NSFileCoordinator.addFilePresenter(presenter)
return presenter
}
That way there will be a NSFilePresenter for each possible secondary SQLite file (e.g. with the main file being foo/bar/database.sqlite there will be presenter for each of the secondary files foo/bar/database.sqlite-shm and foo/bar/database.sqlite-wal)
Using NSFilePresenter to work with SQLite files within the Sandbox environment works as expected.
Desired change
I'd like to expand the usage of NSFileCoordinator to react to changes to the SQLite files that happen outside of the application.
To achieve that I added an additional NSFilePresenter for the main file (e.g. foo/bar/database.sqlite) that has a func presentedItemDidChange() method. That method does get called when I change the corresponding SQLite file (e.g. by using the sqlite3 command line tool).
So far so good. But in WAL mode (https://www.sqlite.org/wal.html), changes to the SQLite file don't immediately change the file itself but get written to the write-ahead-log first (e.g. foo/bar/database.sqlite-wal in this example). Only when the outside connection is closed, will the changes be committed to the main SQLite file itself. At which point the NSFilePresenter#presentedItemDidChange() method will be called. So I also like to be notified when the secondary files change.
Adding a presentedItemDidChange() callback method to the SQLiteTempFilePresenter instances for the secondary files does not seem to work, the method never gets called even though the corresponding secondary files change.
Questions
If I add another instance of the NSFilePresenter for each of the secondary files, the callback presentedItemDidChange() gets called for the secondary files as well. Having two different instance of the NSFilePresenter for a single URL (one for sandboxing purposes, the other for being notified of file changes) seems a bit fishy though. Is that the intended (or at least an acceptable) way of using NSFilePresenter?
The documentation for NSFilePresenter states that "If another process uses a file coordinator for the same file or directory, your presenter objects are similarly notified whenever the other process makes its changes." I do get notified though when using the sqlite3 command line tool which does not use a NSFileCoordinator. Is there any documentation that explains that behaviour? I mean it's great that it seems to work but I'd like to understand why.
Context
I'm using https://github.com/stephencelis/SQLite.swift as the access layer for interacting with SQLite databases.
For each database I maintain a long running connection. As reading the schema is done lazily on each connection and can be expensive I prefer to open the connection once, do a number of operations and then close the connection when it is not needed any more (and given that the app is a GUI for working with SQLite databases, long running means long running).
E.g.
func open(url: URL, options: ...)
func commitCurrentTransaction() throws
func rollbackCurrentTransaction() throws
func executeStatements(rawSQL: RawSQL, executeMode: ExecuteMode) async throws -> SQLOperationResult
...
func close()
To be a good citizen on the Mac I'm looking to use the NSFileCoordinator to indicate read and write operations on the SQLite database files the application is using.
I'm thinking of wrapping each operation that might result in a file access with the corresponding coordinate(readingItemAt: ... and coordinate(writingItemAt: ... calls.
But the API documentation states that the last argument, the block byAccessor should use the given URL:
A Block object containing the file operations you want to perform in a coordinated manner. This block receives an NSURL object containing the URL of the item and returns no value. Always use the URL passed into the block instead of the value in the url parameter.
In my case, the URL is used once when opening the connection but not afterwards so I'd be ignoring the URL passed to the block.
The examples I have found for using the NSFileCoordinator seem to follow a different pattern, where the entire operation on the file happens within the block of the coordinate method.
Questions
What is the correct way of using NSFileCoordinator in a case like this where there essentially is a long live file handle in use?
The application does work without using the NSFileCoordinator. What is the ramification of not using the NSFileCoordinator in this case?
Hi, i tried to pay twice 99$ for Apple developer account, i get
Purchase your membership.
To continue your enrollment, complete your purchase now
Your purchase may take up to 48 hours to process.
I sent a mail to support, also didnt get any response after 48 hours.
What to do ?
I have a custom intent with multiple parameters. Two of the parameters are set up to handle disambiguation dialog. The intent definition file for each of these parameters is almost identical except for the parameter names and the wording in the siri dialog. Similarly, the code in the intent handler to resolve these parameters is nearly identical. But when disambiguation is invoked, the Disambiguation Introduction is only spoken by siri for one of the two parameters. What triggers the Disambiguation Introduction to be spoken in one and not the other?
Here is the intentHandler code to resolve the first parameter (in which siri will speak the Disambiguation Introduction:
- (void)resolvePartsListNameForAddPart:(AddPartIntent *)intent withCompletion:(void (^)(INStringResolutionResult *resolutionResult))completion NS_SWIFT_NAME(resolvePartsListName(for:with:)) API_AVAILABLE(ios(13.0), macos(10.16), watchos(6.0)) {
...
NSMutableArray *options;
options = [[NSMutableArray alloc] init];
NSString *anOption = [NSString stringWithFormat:@"Use '%@' ", intent.partsListName]; // option 1
[options addObject:anOption];
anOption = [NSString stringWithFormat:@"test1"]; // option 2
[options addObject:anOption];
...
anOption = [NSString stringWithFormat:@"test5"]; // option 6
[options addObject:anOption];
completion([INStringResolutionResult disambiguationWithStringsToDisambiguate:[options copy]]);
return;
...
}
Here is the intentHandler code to resolve the second parameter (in which siri DOES NOT speak the Disambiguation Introduction:
- (void)resolveChangeForAddPart:(AddPartIntent *)intent withCompletion:(void (^)(INStringResolutionResult *resolutionResult))completion NS_SWIFT_NAME(resolveChange(for:with:)) API_AVAILABLE(ios(13.0), macos(10.16), watchos(6.0)) {
...
NSMutableArray *options;
options = [[NSMutableArray alloc] init];
NSString *anOption = [NSString stringWithFormat:WOOD_TYPE_PARM]; // option 1
[options addObject:anOption];
// Option 2
anOption = [NSString stringWithFormat:PART_NAME_PARM];
[options addObject:anOption];
// Option 3
anOption = [NSString stringWithFormat:QUANTITY_PARM];
[options addObject:anOption];
// Option 4
anOption = [NSString stringWithFormat:DIMENSION_PARM];
[options addObject:anOption];
// Option 5
anOption = [NSString stringWithFormat:CANCEL_PARM];
[options addObject:anOption];
completion([INStringResolutionResult disambiguationWithStringsToDisambiguate:[options copy]]);
return;
}
Here is the Intents definition for the working parameter where Siri speaks the Disambiguation Introduction:
Here is the Intents definition for the non-working parameter
Again, what triggers the Disambiguation Introduction to be spoken in one and not the other? FYI: it does not make any difference whether or not the Disambiguation Introduction has the parameters 'count' and 'change' (i.e. if I make the introduction be Hello World, it still doesn't get spoken).
User flow:
u1. a user starts playing some audio in the app
before playing was set category
try audioSession.setCategory(.playback,
mode: .default,
policy: .longFormAudio)
was activated category
try audioSession.setActive(true, options: [])
set nowPlayingInfo
playing via AVPlayer
u2. user taps on the button of "airplay" (AVRoutePickerView) and changes the route of sound
u3. A user can hear sounds from a Bluetooth column, or connect to an Apple TV with its own audio system...
Issue: On iOS 17, after changing the route to Apple TV, a user can not hear a sound(apple tv works properly but sounds unavailable(if I do the same on iOS 16 everything works correctly)).
AVPlayer works correctly.
in the app I only receive event(name AVAudioSession.routeChangeNotification), and reason: RouteChangeReason.categoryChange (doc description: The audio category has changed (AVAudioSessionCategoryPlayback has been changed to AVAudioSessionCategoryPlayAndRecord).)
Apps capabilities has "Background Mode" = Audio, AirPlay....
Questions:
Does AirPlay require addition configs on iOS 17?(i tried to add in info.plist "AVInitialRouteSharingPolicy = LongformAudio" - this does not help me)
What going on with AVPlayer?(it is playing, but where sound?)
body of notification
Printing description of notification:
▿ name = AVAudioSessionRouteChangeNotification, object = Optional(<AVAudioSession: 0x280089e10>), userInfo = Optional([AnyHashable("AVAudioSessionRouteChangePreviousRouteKey"): <AVAudioSessionRouteDescription: 0x2800a8960,
inputs = (
);
outputs = (
"<AVAudioSessionPortDescription: 0x2800a8300, type = Speaker; name = \U0414\U0438\U043d\U0430\U043c\U0456\U043a; UID = Speaker; selectedDataSource = (null)>"
)>, AnyHashable("AVAudioSessionRouteChangeReasonKey"): 3])
- name : "AVAudioSessionRouteChangeNotification"
- object : <AVAudioSession: 0x280089e10>
▿ userInfo : 2 elements
▿ 0 : 2 elements
▿ key : AnyHashable("AVAudioSessionRouteChangePreviousRouteKey")
- value : "AVAudioSessionRouteChangePreviousRouteKey"
- value : <AVAudioSessionRouteDescription: 0x2800a8960,
inputs = (
);
outputs = (
"<AVAudioSessionPortDescription: 0x2800a8300, type = Speaker; name = \U0414\U0438\U043d\U0430\U043c\U0456\U043a; UID = Speaker; selectedDataSource = (null)>"
)>
▿ 1 : 2 elements
▿ key : AnyHashable("AVAudioSessionRouteChangeReasonKey")
- value : "AVAudioSessionRouteChangeReasonKey"
- value : 3
I tried to add my Eve Weather and Door & Window.
It failed continuously and immediately with below log.
Nov 23 16:24:50 iPhone-2 homed(HomeKitMatter)[173] <Error>: [589021415/1061261160] CHIP Stack is not running
Nov 23 16:24:50 iPhone-2 homed(HomeKitMatter)[173] <Error>: [589021415/1061261160] CHIP Accessory pairing failed with error Error Domain=HAPErrorDomain Code=3
Nov 23 16:24:50 iPhone-2 homed(HomeKitDaemon)[173] <Error>: [188914BD-5163-425C-9E59-CAE9BFA1A288] Failed to stage CHIP accessory pairing for request UUID <private>: Error Domain=HMErrorDomain Code=18 "Pairing Failed" UserInfo={NSLocalizedDescription=Pairing Failed, NSUnderlyingError=0xc508b7df0 {Error Domain=HAPErrorDomain Code=3}}
Nov 23 16:24:50 iPhone-2 homed(HomeKitDaemon)[173] <Notice>: Answering incoming message HMASC.m.stageCHIPAccessoryPairingInSteps (2D3E9A84-52E8-4614-8B79-A23A5DBC245D) from client 'HomeUIService' that does expect a response with error Error Domain=HMErrorDomain Code=18 "Pairing Failed" UserInfo={NSLocalizedDescription=Pairing Failed, NSUnderlyingError=0xc508b7df0 {Error Domain=HAPErrorDomain Code=3 "(null)"}}
Nov 23 16:24:50 iPhone-2 homed(HomeKitMetrics)[173] <Error>: [188914BD-5163-425C-9E59-CAE9BFA1A288] tag="stagedPairingFailure" desc="Failed to stage CHIP accessory for request UUID" errorDomain="HMErrorDomain" errorCode="18" underlyingErrorDomain="HAPErrorDomain" underlyingErrorCode="3"
Nov 23 16:24:50 iPhone-2 HomeUIService(HomeKit)[521] <Error>: [CF47D609-EF2F-44E3-96EC-89906F4F33C4] Failed to stage CHIP accessory pairing in steps: Error Domain=HMErrorDomain Code=18 UserInfo={NSLocalizedDescription=<private>, NSUnderlyingError=0x283431fe0 {Error Domain=HAPErrorDomain Code=3}}
Hello. I'm gilgim.
I have some questions regarding the review guidelines while working on the project. Therefore, I would like to ask them.
If I implement Apple login on mobile, do I need to implement it on the website as well?
May I inquire if it is permissible to implement a feature that matches a user's Apple ID after they have logged in with Apple and undergone authentication within the app to distinguish users?
Could you please provide detailed information on whether not implementing or implementing such a feature would be a reason for rejection?"
If I prefer for Google to not have access to my data, passwords, and passkeys when possible. Then what is exactly access when using devices via Matter? Does any data pass through even when not using Google services?
Hello everyone!
We have a running Apple Ads Basic campaign - we actually just found out recently as it wasn't visible on the Advanced ads manager. We saw how good the performance is based on the CPI. Our previous CPI ranges between $1-$5, that's why we paused everything under Apple Ads. But seeing the performance on the one under Basic, we're now thinking if it's ideal to continue this or pause it. We have a few questions and we're hoping someone here would give us recommendations or would share their thoughts!
How does the Apple Ads Basic's algorithm works?
Does it only run on one placement, the Search Results?
Is it cost-effective because it's only triggering branded keywords?
We also did a few research but still left confused. On #1, we only saw that it maximizes download. On #2, we found some articles saying this but we'd still love if someone would confirm. On #3, we saw an article that if it's our first time to run a campaign, it would only trigger branded keywords. But we've ran multiple campaigns on Advanced, even in different placements, so this is somehow related to question #1.
Please share if you have any thoughts or experience! Thank you so much 😊
TLDR: How can I listen to changes in SwiftData and share the data via WatchConnectivity?
I am developing an app for the Apple Watch where the iPhone can act as a remote for the Watch.
The App on the Watch should work independently from iPhone. The user can create elements on the Watch and start the action associated with the element. The iPhone user can see the elements created on the Watch and start the action on the Watch from the iPhone (if possible I want to add the functionality to let the user update the elements on both devices, but that's not a priority atm).
I tried to get it to work with CloudKit and SwiftData, but somehow I couldn't get CloudKit to initialize correctly. After further research, I reconned that using WatchConnectivity and ApplicationContext should be a suitable approach.
To communicate with the iPhone App, I created a singleton class that manages the communication. Now I want this class to listen to the changes in SwiftData to send the elements to the iPhone, but I don't know how I can get access to the ModelContext in the Communicator class. I read that passing the value from the initializer of a view is not good practice and it didn't work for me.
What would be a suitable way to achieve the desired behavior of my app? Any help and feedback is appreciated. TIA
Hello,
I wasn't able to figure out how to handle multiple days with DeviceActivitySchedule.
For instance, let's say the user wants to block certain apps from 9:00 AM to 12:00 AM, every day except Saturday and Sunday, how my schedule should look like?
I've tried different things...
This schedule works for each day of the week, but that's not my goal:
let schedule = DeviceActivitySchedule(
intervalStart: DateComponents(hour: 9, minute: 00),
intervalEnd: DateComponents(hour: 12, minute: 00),
repeats: true)
And if I specify the weekDay inside the DateComponents, like this:
// Gregorian calendar
// 2 -> Monday
// 6 -> Friday
let schedule = DeviceActivitySchedule(
intervalStart: DateComponents(..., weekday: 2),
intervalEnd: DateComponents(..., weekday: 6),
repeats: true)
the schedule will block the apps from Monday at 9:00 AM to Friday at 12:00 AM, which is also not my goal.
The only workaround that came to my mind was to create a different schedule for each day of the week:
enum WeekDays: String, CaseIterable {
case sun, mon, tue, wed, thu, fri, sat
var sortOrder: Int {
switch self {
case .sun: return 1
case .mon: return 2
case .tue: return 3
case .wed: return 4
case .thu: return 5
case .fri: return 6
case .sat: return 7
}
}
}
func startMonitoring(weekDays: [WeekDays]) {
for weekDay in weekDays {
let day = weekDay.sortOrder
let schedule = DeviceActivitySchedule(
intervalStart: DateComponents(
hour: 9,
minute: 00,
weekday: day),
intervalEnd: DateComponents(
hour: 12,
minute: 00,
weekday: day),
repeats: true)
let activityName = DeviceActivityName(weekDay.rawValue)
do {
try center.startMonitoring(activityName,
during: schedule)
} catch {
print("DEBUG: Error: \(error.localizedDescription)")
}
}
}
This way I kinda get what I want, for example:
I can specify 3 days of the week, let's say Monday, Tuesday and Wednesday, the time interval, let's keep 9:00 AM - 12:00 AM, and this function will block apps on Monday, Tuesday and Wednesday at that time interval, fine.
However...
What if I also want another schedule that blocks at a different time interval but same day?
For example, I want to block certain apps Monday and Tuesday from 2:00 PM - 6:00 PM.
Following the example above the activityName would be overwritten, so the user ( for Monday and Tuesday ) would now have only the schedules that starts from 2:00 PM.
Basically, I want the user to be able to select multiple days for a schedule and to let them create as many schedules as they want.
Does anybody know the correct way to handle multiple days schedules?
Hi!
In Apple Pay for iMessage, users can initiate an Apple Pay payment on iMessage. Once the user authorizes the payment, my endpoint receives the Apple Pay Token from Apple- this has the user's encrypted payment details. This is where i would need to integrate with a payment processor to accept the payment.
Well, I am having trouble figuring out how to process this token payment.
According to this link, Stripe and other authorized payment processors are supposed to fully handle this token on their own? From my understanding I would simply be forwarding the apple pay token to Stripe. Unfortunately, stripe isn't accepting the payment token as valid and i am not sure why as i couldn't find documentation from apple nor stripe on how to process this (If anyone can point me to them, please let me know). I tried using the Stripe python package and passing in the token as the 'source' for ".charge" but it doesn't work as stripe doesn't understand.
Anyways, where am I going wrong here nothing else is working and I am not sure what I should do? Do i need to do something to de-encrypt the apple pay token, I am not even sure if I'd have the regulatory approval to do this. If anyone can point me to the correct Apple docs on integration instructions, I would appreciate it!
P.S This is not for apple pay web or js integration.