Overview

Post

Replies

Boosts

Views

Activity

Progress bar in NSTableCellView changes to other cell when scrolling
Hello, I'm not I00% sure how to ask this, so I apologize if I word it wrong. This is Obj-C from an older project I have. My app has a NSTableView and each cell has a button to perform and action and shows a progress bar in each cell. The issue I'm running in to is when I scroll down while a task is running the running progress bar shows running on a different cell. So if its he 2nd from the bottom and a scroll an even number of row its equivalent is now showing the progress bar. How do I target just that one cell; making it unique?
0
0
45
15h
ControlWidget in iOS 18 Beta not showing and the widget created prior to iOS18 Beta not showing too.
I tried creating a ControlWidget following this Apple document - https://developer.apple.com/documentation/widgetkit/creating-controls-to-perform-actions-across-the-system, but for some reason the Control is not showing while I am trying to add and on top of that the widget which we created prior to iOS18 is also not showing, while trying to add. Here is the gist of code : struct WidgetLauncher{ static func main() { if #available(iOSApplicationExtension 18.0, *) { appWidgetsFor18.main() } else { appWidgets.main() } struct apptWorkWidgets: WidgetBundle { var body: some Widget { WidgetPriorToiOS18() } } @available(iOSApplicationExtension 18.0, *) struct appWidgetsFor18: WidgetBundle { var body: some Widget { WidgetPriorToiOS18() PerformActionButton() //This from the apple's document. } } @available(iOSApplicationExtension 18.0, *) struct PerformActionButton: ControlWidget { var body: some ControlWidgetConfiguration { StaticControlConfiguration( kind: "com.example.myApp.performActionButton" ) { ControlWidgetButton(action: PerformAction()) { Label("Perform Action", systemImage: "checkmark.circle") } } .displayName("Perform Action") .description("An example control that performs an action.") } } struct PerformAction: AppIntent { static let title: LocalizedStringResource = "Perform action" func perform() async throws -> some IntentResult { // Code that performs the action... return .result() } }
0
0
43
16h
Share arbitrary struct from HostApp to Extension and get arbitrary result back
I want to share a Transferable (JSON-encoded) data struct from some HostApp with an Extension of my ContainingApp, and get a different Transferable (also JSON-encoded) data struct back on success. Since I want to present my ContainingApp's AppIcon in the sharing sheet to make it easy for the user to find it, I started building a Sharing Extension and not an Action Extension. AFAIK the difference is only in the presentation (Sharing Extension: Icon+name of the ContainingApp vs Action Extension: simple b/w system icon plus a string describing the action (e.g. "Copy", "Save to Files")), and the data flow is identical. Please correct me if I'm wrong. I added the Sharing Extension to my ContainingApp (which are both in the same app group so they can use a shared container to exchange data). The (real) HostApp is from a different company we are collaborating with, and thus is not in our app group. Once everything runs I will add a tailored NSExtensionActivationRule to make sure our Sharing Extension is only shown to our partner's HostApp. Currently I am still using TRUEPREDICATE. The goal is that after the user tapped the "Continue with ContainingApp" (Share-)button in the HostApp, iOS will only show my ContainingApp icon and nothing else, since that's the only useful choice for the user. Side Question 1: The best user experience would be if the HostApp could directly present our extension when the user tapped the "Continue with ContainingApp"-button, without the user needing to choose it manually in the Share-sheet, but I guess this is not possible for privacy/security reasons, right? In the debugger of the HostApp I see this error: Type "com.myapp.shareInput" was expected to be exported in the Info.plist of Host.app, but it was imported instead. Library: UniformTypeIdentifiers | Subsystem: com.apple.runtime-issues | Category: Type Declaration Issues but I definitely want to define and export both ShareInput and ShareResult as UTExportedTypeDeclarations in my extension, and all 3rd-party apps (like this demo HostApp) using my extension need to import them. Side Question 2: Can I just ignore this error? And tell the 3rd-party app developers they also can ignore it? After the user tapped on the ContainingApp icon in the sharing dialog, my Sharing Extension will show its dialog, presenting the shared item it got from the HostApp, and let the user edit the text. When the user taps the "Save"-button in my extension, it creates a ShareResult struct to send back to the HostApp, and dismisses the sheet. This (kinda) works when I share plain text with the 􀈂Text button in my HostApp. My ContainingApp icon is shown together with Mail, Messages, and other apps that can process plain text; with shortcuts to persons and devices (AirDrop targets) in the line above, and with actions (Copy, New Quick Note, Save to Files, Save to Citator, Certificat, Airdrop) below. When I choose my ContainingApp, the extension runs and shows the text it got. ("Kinda" because I am still struggling to send data back. See below...) So the principal operation works... Side Question 3: In the HostApp, can I use ShareLink() to present the Share-sheet and receive the result struct or do I always need to activityViewController!.completionWithItemsHandler = completionHandler windowScene.keyWindow?.rootViewController?.present(activityViewController!, animated: true, completion: nil) and process the result in the completionHandler? If returning (any) data from the extension is possible with ShareLink() also, then how? I didn't find any sample showing this... I implemented the ShareLink() anyway (and ignore the result part for the moment). When I try to share a ShareInput struct with the 􀈂ShareLink button, the same persons are sorted differently, there are less app icons (9 instead of 13), and less actions (only 3: New Quick Note, Save to Files, AirDrop): Note that while the preview correctly shows the preview text provided ("shareInput"), the preview image left of it is blank (instead of arrowshape.right.fill): let preview = SharePreview("shareInput", image: Image(systemName: "arrowshape.right.fill")) When I choose my ContainingApp, the extension runs ... On iOS17, I see that indeed my ShareInput data arrived in my extension: ❗️itemProvider=<NSItemProvider: 0x301b1c460> {types = ( "com.myapp.shareInput" )} Library: ShareExtension | Subsystem: com.myapp.containingdemo.ShareExtensionDemo | Category: ShareSheet However, on iOS 16 it doesn't work: Host[8615:634470] [Type Declaration Issues] Type "com.myapp.shareInput" was expected to be exported in the Info.plist of Host.app, but it was imported instead. Host[8615:634462] [ShareSheet] Couldn't load file URL for Collaboration Item Provider:<NSItemProvider: 0x280f49180> {types = ( "com.myapp.shareInput" )} : (null) That error is shown before I choose the ContainingApp to share with. When I do that, I get: ShareExtension[8774:636786] [ShareSheet] ❗️itemProvider=<NSItemProvider: 0x28243a300> {types = ( "dyn.age8u", "public.file-url" )} which clearly shows the ShareInput struct was not transferred to the extension. But since I don't know how to transfer the ShareResult back to the HostApp when using a ShareLink, I cannot continue this approach anyway. When I try to share a ShareInput struct with the 􀈂JSON button (using present(activityViewController)), I see (both on iOS 16 and iOS 17): My extension (rather, the ContainingApp's icon) is not shown as Sharing target (even though it still has TRUEPREDICATE), which means that my code didn't manage to pack the ShareInput struct for the activityViewController - and thus it doesn't know what to share. I did the same as with the plainText item before: let shareInput = ShareInput(inputStr: "ShareInput as JSON") let preview = SharePreview("shareInput", image: Image(systemName: "arrowshape.right.fill")) VStack(spacing: 25.0) { Text("HostApp!") ShareButton(title: "Text", shareItems: [ItemSource(dataToShare: "sharing some text")]) ShareButton(title: "JSON", shareItems: [ItemSource(dataToShare: shareInput)]) ShareLink("ShareLink", item: shareInput, preview: preview) } (I will continue in the next posting)
4
0
101
5d
Cannot create new release page on "Apple Developer Program License Agreement" has been updated
Hi, When trying to create a new release for my app on App Store Connect, I am getting the error: -- Agreement Update The Apple Developer Program License Agreement has been updated and needs to be reviewed. In order to update your existing apps and submit new apps, the Account Holder must review and accept the updated agreement by signing in to their account on the Apple Developer website. -- However, when looking under Agreements in the Account page, it shows that the latest agreement was accepted on July 1, 2024: -- Agreements Apple Developer Program License Agreement Issued June 10, 2024. Accepted July 1, 2024. Apple Developer Agreement Issued June 7, 2015. Accepted March 25, 2020. -- What am I missing?
0
0
115
16h
Step Data Duplication Issue with Apple Health Integration
We are integrating Apple Health step data into our mobile application, Diyetkolik. However, we have received feedback from our users indicating that the step data appears to be significantly higher than expected. After conducting thorough research, we discovered that users who wear a smartwatch are experiencing step data duplication. Both the smartwatch and the phone's step data are being collected and combined, leading to inflated step counts in our application. We kindly request your assistance in addressing the following issues: How can we differentiate between step data from the smartwatch and the phone to avoid duplication? Are there best practices or specific APIs we should use to filter and manage step data more accurately? Can you provide guidance on how to implement a solution that ensures accurate step count data for users wearing multiple devices? We appreciate your support in resolving this matter to enhance the accuracy of our application and improve user experience.
0
0
43
16h
Issues with launching a stream in AVPlayer using AppIntent on iOS
I am implementing Siri/Shortcuts for radio app for iOS. I have implemented AppIntent that sends notification to app and app should start playing the stream in AVPlayer. AppIntent sometimes works, sometimes it doesn't. So far I couldn't find the pattern when/why it works and when/why it doesn't. Sometimes it works even if app is killed or is in the background. Sometimes it doesn't work when the app is in the background and when it is killed. I have been observing logs in Console and apparently sometimes it stops when AVPlayer tries to figure out buffer size (then I am getting in console AVPlayerWaitingToMinimizeStallsReason and the AVPlayerItem status is set to .unknown). Sometimes it figures out quickly (for the same stream) and starts playing. Sometimes when the app is killed, after AppIntent call the app is launched in the background (at least I see it as a process in Console) and receives notification from AppIntent and start playing. Sometimes... the app is not called at all, and its process is not visible in the console, so it doesn't receives the notification and doesn't play. I have setup Session correctly (set to .playback without any options and activated), I set AVPlayerItem's preferredForwardBufferDuration to 0 (default), and AVPlayer's automaticallyWaitsToMinimizeStalling to true. Background processing, Audio, AirPlay, Picture in Picture and Siri are added in Singing & Capabilities section of the app project settings. Here are the code examples: Play AppIntent (Stop App Intent is constructed the same way): @available(iOS 16, *) struct PlayStationIntent: AudioPlaybackIntent { static let title: LocalizedStringResource = "Start playing" static let description = IntentDescription("Plays currently selected radio") @MainActor func perform() async throws -> some IntentResult { NotificationCenter.default.post(name: IntentsNotifications.siriPlayCurrentStationNotificationName, object: nil) return .result() } } AppShortcutsProvider: struct RadioTestShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: PlayStationIntent(), phrases: [ "Start station in \(.applicationName)", ], shortTitle: LocalizedStringResource("Play station"), systemImageName: "radio" ) } } Player object: class Player: ObservableObject { private let session = AVAudioSession.sharedInstance() private let streamURL = URL(string: "http://radio.rockserwis.fm/live")! private var player: AVPlayer? private var item: AVPlayerItem? var cancellables = Set<AnyCancellable>() typealias UInfo = [AnyHashable: Any] @Published var status: Player.Status = .stopped @Published var isPlaying = false func setupSession() { do { try session.setCategory(.playback) } catch { print("*** Error setting up category audio session: \(error), \(error.localizedDescription)") } do { try session.setActive(true) } catch { print("*** Error setting audio session active: \(error), \(error.localizedDescription)") } } func setupPlayer() { item = AVPlayerItem(url: streamURL) item?.preferredForwardBufferDuration = TimeInterval(0) player = AVPlayer(playerItem: item) player?.automaticallyWaitsToMinimizeStalling = true player?.allowsExternalPlayback = false let metaDataOuptut = AVPlayerItemMetadataOutput(identifiers: nil) } func play() { setupPlayer() setupSession() handleInterruption() player?.play() isPlaying = true player?.currentItem?.publisher(for: \.status) .receive(on: DispatchQueue.main) .sink(receiveValue: { status in self.handle(status: status) }) .store(in: &self.cancellables) } func stop() { player?.pause() player = nil isPlaying = false status = .stopped } func handle(status: AVPlayerItem.Status) { ... } func handleInterruption() { ... } func handle(interruptionType: AVAudioSession.InterruptionType?, userInfo: UInfo?) { ... } } extension Player { enum Status { case waiting, ready, failed, stopped } } extension Player { func setupRemoteTransportControls() { ... } } Content view: struct ContentView: View { @EnvironmentObject var player: Player var body: some View { VStack(spacing: 20) { Text("AppIntents Radio Test App") .font(.title) Button { if player.isPlaying { player.stop() } else { player.play() } } label: { Image(systemName: player.isPlaying ? "pause.circle" : "play.circle") .font(.system(size: 80)) } } .padding() } } #Preview { ContentView() } Main struct: ```import SwiftUI @main struct RadioTestApp: App { let player = Player() let siriPlayCurrentPub = NotificationCenter.default.publisher(for: IntentsNotifications.siriPlayCurrentStationNotificationName) let siriStop = NotificationCenter.default.publisher(for: IntentsNotifications.siriStopRadioNotificationName) var body: some Scene { WindowGroup { ContentView() .environmentObject(player) .onReceive(siriPlayCurrentPub, perform: { _ in player.play() }) .onReceive(siriStop, perform: { _ in player.stop() }) } } }
0
0
45
17h
How to replicate UIImageView's `scaleAspectFill` for Images inside a custom Layout?
I've defined a custom layout container by having a struct conform to Layout and implementing the appropriate methods, and it works as expected. The problem comes when trying to display Image, as they are shown squished when just using the .resizable() view modifier, not filling the container when using .scaledToFit() or extending outside of the expected bounds when using .scaledToFill(). I understand that this is the intended behaviour of these modifiers, but I would like to replicate UIImageView's scaledAspectFill. I know that this can usually be achieved by doing: Image("adriana-wide") .resizable() .scaledToFill() .frame(width: 200, height: 200) .clipped() But hardcoding the frame like that defeats the purpose of using the Layout, plus I wouldn't have direct access to the correct sizes, either. The only way I've managed to make it work is by having a GeometryReader per image, so that the expected frame size is known and can bet set, but this is cumbersome and not really reusable. GalleryGridLayout() { GeometryReader { geometry in Image("adriana-wide") .resizable() .scaledToFill() .frame(width: geometry.size.width, height: geometry.size.height) .clipped() } [...] } Is there a more elegant, and presumably efficient as well as reusable, way of achieving the desired behaviour? Here's the code of the Layout.
3
0
299
Jun ’24
Circular Dependency when Creating
I am following these instructions to created a Safari Web Extension App project: https://developer.apple.com/documentation/safariservices/safari_web_extensions/creating_a_safari_web_extension When I try to compile the default code, I get this error: Circular dependency between modules 'Dispatch' and 'Foundation' At one point, it showed the error was in generatedassetssymbols.swift file, although I cant replicate that now. macOS, Sonoma 14.0, xcode 15.4 Anyone know what is going on? It is literally the default project without any changes.
1
0
107
2d
Storekit
I made in-app purchases using storekit and placed the ids in app store connect, but when I tried to test my application from Xcode, the purchase of the application was working, but when I tried it from the app store, it did not work.
0
0
36
18h
ModelActors not persisting relationships in iOS 18 beta
I've already submitted this as a bug report to Apple, but I am posting here so others can save themselves some troubleshooting. This is submitted as FB14337982 with an attached complete Xcode project to replicate. In iOS 17 we use a ModelActor to download data which is saved as an Event, and then save it to SwiftData with a relationship to a Location. In iOS 18 22A5307d we are seeing that this code no longer persists the relationship to the Location, but still saves the Event. If we put a breakpoint in that ModelActor we see that the object graph is correct within the ModelActor stack trace at the time we call modelContext.save(). However, after saving, the relationship is missing from the default.store SQLite file, and of course from the app UI. Here is a toy example showing how inserting an Employee into a Company using a ModelActor gives unexpected results in iOS 18 22A5307d but works as expected in iOS 17. It appears that no relationships data survives being saved in a ModelActor.ModelContext. Also note there seems to be a return of the old bug that saving this data in the ModelActor does not update the @Query in the UI in iOS 18 but does so in iOS 17. Models @Model final class Employee { var uuid: UUID = UUID() @Relationship(deleteRule: .nullify) public var company: Company? /// For a concise display @Transient var name: String { self.uuid.uuidString.components(separatedBy: "-").first ?? "NIL" } init(company: Company?) { self.company = company } } @Model final class Company { var uuid: UUID = UUID() @Relationship(deleteRule: .cascade, inverse: \Employee.company) public var employees: [Employee]? = [] /// For a concise display @Transient var name: String { self.uuid.uuidString.components(separatedBy: "-").first ?? "NIL" } init() { } } ModelActor import OSLog private let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "SimpleModelActor") @ModelActor final actor SimpleModelActor { func addEmployeeTo(CompanyWithID companyID: PersistentIdentifier?) { guard let companyID, let company: Company = self[companyID, as: Company.self] else { logger.error("Could not get a company") return } let newEmployee = Employee(company: company) modelContext.insert(newEmployee) logger.notice("Created employee \(newEmployee.name) in Company \(newEmployee.company?.name ?? "NIL")") try! modelContext.save() } } ContentView import OSLog private let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "View") struct ContentView: View { @Environment(\.modelContext) private var modelContext @Query private var companies: [Company] @Query private var employees: [Employee] @State private var simpleModelActor: SimpleModelActor! var body: some View { ScrollView { LazyVStack { DisclosureGroup("Instructions") { Text(""" Instructions: 1. In iOS 17, tap Add in View. Observe that an employee is added with Company matching the shown company name. 2. In iOS 18 beta (22A5307d), tap Add in ModelActor. Note that the View does not update (bug 1). Note in the XCode console that an Employee was created with a relationship to a Company. 3. Open the default.store SQLite file and observe that the created Employee does not have a Company relationship (bug 2). The relationship was not saved. 4. Tap Add in View. The same code is now executed in a Button closure. Note in the XCode console again that an Employee was created with a relationship to a Company. The View now updates showing both the previously created Employee with NIL company, and the View-created employee with the expected company. """) .font(.footnote) } .padding() Section("**Companies**") { ForEach(companies) { company in Text(company.name) } } .padding(.bottom) Section("**Employees**") { ForEach(employees) { employee in Text("Employee \(employee.name) in company \(employee.company?.name ?? "NIL")") } } Button("Add in View") { let newEmployee = Employee(company: companies.first) modelContext.insert(newEmployee) logger.notice("Created employee \(newEmployee.name) in Company \(newEmployee.company?.name ?? "NIL")") try! modelContext.save() } .buttonStyle(.bordered) Button("Add in ModelActor") { Task { await simpleModelActor.addEmployeeTo(CompanyWithID: companies.first?.persistentModelID) } } .buttonStyle(.bordered) } } .onAppear { simpleModelActor = SimpleModelActor(modelContainer: modelContext.container) if companies.isEmpty { let newCompany = Company() modelContext.insert(newCompany) try! modelContext.save() } } } }
0
0
44
18h
Appstore: Put a decommission message in the app's description
Hi team, Our app is going to upgrade the backend infrastructure which needs to inform an announcement to the users. It seems there is a limitation that doesn't allow a message related to the decommissioning put up on the App's home page. I have check some docs over internet but still not found any official one specify this topic. Can we just put the message as mentioned above or there is actually a limit which not allow to add it in? Thanks
1
0
56
1d
SpriteKit PPI
Hi, I’m looking for a way to keep some custom buttons in SpriteKit the same physical size (inches) accross iOS devices (or only slightly vary their size so they’re not humongous on large screens). How do I get PPI in Swift? (cannot be library code which doesn’t compile in Swift Playgrounds). I will use PPI for determining total screen size which I will use to determine how to adjust the button sizes while also respecting some physical desirable dimensions for the buttons. I'm only asking for handheld (same distance from eyes to screen) use, so I don't care about Apple TV (longer distance).
2
0
71
19h
Developing and deploying iPhone test code in Windows environment
Hello, I am developing Java test code to test a web application on an Android and iPhone platforms using Selenium and Appium inside Eclipse IDE. Android device could be tested just fine. When it comes to instantiation of iOSDriver Object for running test script on an iPhone, the run time is complaining that it needs Xcode libraries, or Xcode tool on the class path. This makes it necessary to use a mac system for coding and install Xcode on it. Once I use a mac and develop the test code within my Eclipse, can I deploy the code on a Windows Server? Does the code would not need Xcode during run time or just the Selenium-java client libraries and Appium alone? Thanks a lot, -- Prasad Nutalapati
0
0
50
19h
XSLT 2.0 transformation with Swift or WKWebView
I am re-writing with Xcode and Swift two applications (DDB Access, SmartHanzi) initially written with Xamarin and C#. Both apps are with separate macOS and iOS versions (storyboard). In the original version, XSLT 2.0 transformations were applied with C#. With Swift and WKWebView, after carefully reviewing the documentation, I just found: XSLT 1.0 transformation for macOS (Swift). Nothing at all for iOS. Some years ago, there seemed to be a possibility with an external C library, but it was also mentioned that at a moment it was no more accepted by the App Store. Did I miss something in the documentation and how can I apply these XSLT 2.0 transformations (preferrably from an XML string but temporary files would be acceptable)?
2
0
52
20h
Xcode previews fail with JIT error
== PREVIEW UPDATE ERROR: JITError ================================== | NoBuiltTargetDescriptionCouldBeFound | | translationUnit: PreviewTranslationUnit(moduleNamePrefix: "Previews_EmptyFeedRow", sourceIdentifier: file:///Users/bryananderson/Developer/JournalApp/JournalApp/Interface/Feed/EmptyFeedRow.swift -> EmptyFeedRow.swift, parseTree: ParseTree(version: 727, statements: 3, providers: 1), update: nil, changesContextMemoizer: PreviewsPipeline.PreviewTranslationUnit.(unknown context at $34b4b9c4c).ChangesContextMemoizer(parseTree: ParseTree(version: 727, statements: 3, providers: 1), sourceIdentifier: file:///Users/bryananderson/Developer/JournalApp/JournalApp/Interface/Feed/EmptyFeedRow.swift -> EmptyFeedRow.swift, cachedValue: os.OSAllocatedUnfairLock<Swift.Optional<PreviewsModel.ParseTree.PreviewChangesContext>>(__lock: Swift.ManagedBuffer<Swift.Optional<PreviewsModel.ParseTree.PreviewChangesContext>, __C.os_unfair_lock_s>)), registryDeclarationMemoizer: PreviewsPipeline.PreviewTranslationUnit.(unknown context at $34b4b9bec).RegistryDeclarationMemoizer) | | builtTargetDescriptions: | == VERSION INFO: Tools: 16A5171c OS: 24A5264n PID: 906 Model: MacBook Pro Arch: arm64e == ENVIRONMENT: openFiles = [ /Users/bryananderson/Developer/JournalApp/JournalApp/Interface/Feed/EmptyFeedRow.swift ] wantsNewBuildSystem = true newBuildSystemAvailable = true activeScheme = JournalApp activeRunDestination = iPhone 15 Pro variant iphonesimulator arm64 workspaceArena = [x] buildArena = [x] buildableEntries = [ Remember.app ] runMode = JIT Executor == SELECTED RUN DESTINATION: name = iPhone 15 Pro eligible = true sdk = Optional(<DVTSDK:0x13870da30:'iphonesimulator18.0':Simulator - iOS 18.0:<DVTFilePath:0x600001e8c700:'/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.0.sdk'>>) variant = Optional("iphonesimulator") device = Optional(<DVTiPhoneSimulator: 0x32f00d290> { SimDevice: iPhone 15 Pro (CF3C85BC-F559-4437-9072-7F30153B399B, iOS 18.0, Booted) PairedSim: <DVTiPhoneSimulator: 0x33733d150> { SimDevice: Apple Watch Series 9 (45mm) (627CE93E-EB02-4200-BE40-3DCB5C91DB44, watchOS 11.0, Shutdown) } }) == SELECTED RUN DESTINATION: Simulator - iOS 18.0 | iphonesimulator | arm64 | iPhone 15 Pro | Apple Watch Series 9 (45mm) jit enabled: true fallback to dynamic replacement: false
6
2
292
3w