Post

Replies

Boosts

Views

Activity

Alternative for crashing API MPMediaItemArtwork
When setting the now playing info for playing media in MPNowPlayingInfoCenter we can set artwork. But it seems the Apple API for creating the artwork is crashing on iOS 18 (FB15145734). On iOS 17 this gave the warning that the completion handler was not run on the main thread. I've tried to seek help here: https://stackoverflow.com/questions/78989543/swift-data-race-with-appkit-mpmediaitemartwork-function/78990231?noredirect=1#comment139277425_78990231 but it seems that it's not possible to override the completion handler and therefor it's up to Apple to fix this issue. .task { await MainActor.run { let nowPlayingInfoCenter = MPNowPlayingInfoCenter.default() var nowPlayingInfo = [String: Any]() let image = NSImage(named: "image")! // warning: data race detected: @MainActor function at MPMediaItemArtwork/ContentView.swift:22 was not called on the main thread nowPlayingInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(boundsSize: image.size, requestHandler: { _ in // Not on main thread here! return image }) nowPlayingInfoCenter.nowPlayingInfo = nowPlayingInfo } } I'm wondering if there is an alternative method to set the now playing artwork?
3
0
457
Sep ’24
Xcode Cloud comms errors - "A server with the specified hostname could not be found."
I have Xcode Cloud setup to run my unit tests a couple of times a day so I can be informed of any API issues. Quite often, my tests will fail with "A server with the specified hostname could not be found." even though the server is fine. I re-run the tests locally in Xcode and they all pass. I'm wondering if there's something Xcode Cloud might be doing to the request to make the connection fail? Is it possible to maybe setup a proxy for the tests from Xcode Cloud?
2
4
798
Oct ’23
Xcode Cloud not sending notification emails
I have some Test actions setup in Xcode cloud. Under Post-Actions I have selected Notify - Success and Failures. At the bottom it says: You automatically receive email or Slack notifications for your builds Yet I don't receive any emails... If I add an email address to the Notify section, I now receive 2x emails. 1 to the email I added and 1 to the email on my account. If I change the added email to be the same as the one on my account, I get 2x emails to that address. This is as expected. However if I remove the added email, I get no emails at all, whereas i'd expect to receive an email to my account address.
0
0
1.1k
Apr ’23
Xcode Server "Authentication failed because the credentials were missing"
I am struggling to get my Xcode Server working using Xcode 14.2 It used to work, but since the 14.3 upgrade left the Xcode builder constantly crashing (FB12090800) i'm trying to get it set back up in Xcode 14.2 I've completely reset everything by deleting all Keychain entries regarding Xcode and using the command sudo xcrun xcscontrol --reset Now when I run my new integrations, I get the error: Authentication failed because the credentials were missing I've created a new RSA certificate as documented here: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent Added it to my Github account as documented here: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account When I click Edit Bot... in Xcode and select the Repositories tab it successfully loads my repo. Yet when I click to Integrate the bot, it fails with the auth error. Xcode server is running on my main mac under the same root user I log in as. The failed integration offers up a Fix it button, but that crashes Xcode (FB11875463) and has done for all of Xcode 14.x I can load up Xcode 13 and hit the Fix it button, but all it does is open the same Repositories tab that successfully loads my repo. I've tried adding this to my GitHub config but it makes no difference: [url "ssh://git@github.com/"] insteadOf = https://github.com/ What else can I try?
1
1
1.8k
Apr ’23
Xcode 14.3 Server Builder keeps crashing
I just installed Xcode 14.3 and now my Xcode Server doesn't work. The Xcode Server Builder keeps opening then crashing. I've tried disabling Xcode Server and even resetting it all using the command "sudo xcrun xcscontrol --reset" but whenever I start it up the Builder keeps crashing. Any other suggestions I can try? Resetting and starting through Xcode 14.2 works fine. Crash log: xcode.crash
5
6
3.1k
Apr ’23
Xcode 14.2 randomly removes Apple dev accounts if more than 1
For years i've managed multiple AppleID accounts through Xcode. Xcode->Settings->Accounts would list them as logged in. Now with Xcode 14.2, i'll often go to sign a build or register a device and it'll tell me there's no account for the build. Looking in accounts it has removed all but 1. This happens very often. I am constantly having to re-login to account. I haven't managed to figure out when or what causes them to be removed. Restarting Xcode or the Mac can still leave them logged in, but after a period they just get removed. Anyone else experiencing this or have suggestions to fix it?
2
1
1.2k
Feb ’23
Xcode Organiser is trying to download crashes from wrong account after transferring app
I transferred an app to a new developer account about 2 months ago. Since then, I am unable to view crashes through the Xcode Organiser. It gives me the error title "Error downloading Crashes List" with message "An error occurred preventing Xcode from downloading crashes list. xxxxxx@xxxxxx failed with error: Access Restricted with bundle id: xxxxx.xxxxx.xxxxx The account listed is the OLD account that owned the app. So it is trying to download crash reports from the old account and not the new account. How can I let it know the account changed for this app? The project itself has been updated to use the new account certs and i've even submitted multiple builds to the new account.
9
7
6.1k
Jan ’23
ITMS-90428: Invalid Swift Support - The files libswift_Concurrency.dylib don’t match
I am trying to upload a new build of my app from the new Xcode 14.1 RC but it keeps failing with the below error: ITMS-90428: Invalid Swift Support - The files libswift_Concurrency.dylib don’t match /Payload/MY_APP.app/MY_APP_WatchOS.app/libswift_Concurrency.dylib. Make sure the files are correct, rebuild your app, and resubmit it. Don’t apply post-processing to /Payload/MY_APP.app/MY_APP_WatchOS.app/libswift_Concurrency.dylib. My bundle contains a watchOS 4.3 app which I thought might have been an issue, so I tried increasing it to watchOS 7.0 but still got the error. Bitcode is disabled for all targets. I don't have post-processing enabled either.
12
1
4.1k
Oct ’22
NavigationLink inside NavigationSplitView strange behaviours
I have a very simple NavigationSplitView setup. The first time you press the NavigationLink it pushes the next view, but then immediately dismisses it. Tap it again and it correctly pushes and stays on screen. Then when tapping the second NavigationLink it pushes a view but just shows a yellow warning triangle and not the text. Then when pressing the back button, it shows the initial view first, then the second view 🤷‍♂️ This is on iOS 16 beta 4. Any idea what is going on here? struct ContentView: View {     @State var splitViewVisibility: NavigationSplitViewVisibility = .all     var body: some View {         NavigationSplitView(columnVisibility: $splitViewVisibility) {             List {                 NavigationLink("First", destination: DetailView(string: "First"))             }         } detail: {             Text("Select the first view from the list")         }         .navigationSplitViewStyle(.balanced)     } } struct DetailView: View {     var string: String     var body: some View {         NavigationStack() {             List {                 NavigationLink("Second", value: "Second")             }             .navigationDestination(for: String.self, destination: { string in                 Text(string)             })         }         .navigationTitle(string)     } }
1
2
2.5k
Jul ’22
Framework signature won't upgrade past v=20200
I have some third party frameworks that are signed with a v=20200 signature. When I add them to my project and set them to Embed and Sign, the app won't install on my device giving the error The code signature version is no longer supported. I have tried resigning them using codesign -s "Apple Development: XXXX XXXX (BLXXXXXX)" -f --preserve-metadata --generate-entitlement-der XXXSDK.xcframework but the signature always reports v=20200. I tried removing the code sign and letting Xcode do it's thing, but get the same result. Is this a problem with the way the .xcframework was built? Can I fix this without getting it rebuilt?
6
0
2.5k
May ’22
ASWebAuthenticationSession won't open the Safari login window on Monterey
My macOS app uses ASWebAuthenticationSession for users to login to a third party service. It's worked fine until Monterey. When I call start on ASWebAuthenticationSession it shows me the permission window as expected: However when I click Continue nothing else happens. It does not show the Safari window and load the login page. I've noticed these errors appear in the Console every time, so it seems it's having trouble opening Safari (even though I have Safari already open). Any suggestions on how to fix this? Surely ASWebAuthenticationSession isn't broken for everyone? error 10:40:50.598301+0000 kernel 43 duplicate reports for Sandbox: com.apple.WebKit(13346) deny(1) mach-lookup com.apple.diagnosticd error 10:40:50.598309+0000 kernel Sandbox: SafariLaunchAgen(5469) deny(1) system-fsctl _IO('h', 47) error 10:40:52.349729+0000 kernel Sandbox: com.apple.WebKit(6675) deny(1) mach-lookup com.apple.diagnosticd error 10:40:53.011948+0000 CoreServicesUIAgent LAUNCH: Launch failure with -10652/ <FSNode 0x60000068b6e0> { isDir = y, path = '/Applications/Safari.app' } error 10:40:53.019505+0000 CoreServicesUIAgent Unable to forward entitlements from overridden keySenderAuditTokenAttr [sess=100005 pid=5469 uid:501,501,501 g:20,20 pV:257536] to target port ( port:85539/0x14e23 rcv:0,send:2,d:0 limit:0), which will likely cause them to reject this AppleEvent, errorRef=[ NULL ]
16
0
7.6k
Nov ’21
SwiftUI NavigationView initial selection (iOS 15)
I'm trying to get a NavigationView to pre select an initial view but it seems impossible to get it working across both iPhone and iPad. Here's a very basic model with 3 views: struct SomeView: Hashable { let title: String let view: Text func hash(into hasher: inout Hasher) { hasher.combine(title) } } let destinations = [ SomeView(title: "View0", view: Text("View0")), SomeView(title: "View1", view: Text("View1")), SomeView(title: "View2", view: Text("View2")) ] and here's a very simple navigation view: struct ContentView: View { @State var initialSelection: SomeView? = destinations[0] var body: some View { NavigationView { SideBar(selected: $initialSelection) } } } struct SideBar: View { @Binding var selected: SomeView? var body: some View { List { ForEach(destinations, id: \.self) { d in NavigationLink(d.title, destination: d.view, tag: d, selection: $selected) } } } } When launched on an iPhone 13 Pro Max in Portrait mode, it correctly shows View0. When launched in Landscape mode, we get a blank screen with a back button. So it appears that the selection property of the NavigationLink will only work if that NavigationLink is drawn on the screen. I guess that makes sense. We can fix it by adding our default view to the NavigationView stack like this: var body: some View { NavigationView { SideBar(selected: $initialSelection) initialSelection?.view } } Now in Landscape mode we get the View0 showing. However when we tap the back button, nothing happens on the first tap. This is because tapping back, loads up the List view which triggers the selection property to show our default view. Tapping back for a second time, works. I tried to fix this using some logic to know if the NavigationView had actually shown the second column view or not, however it seems that even on an iPhone in portrait when it displays as a stack, the .onAppear code (shown below) still fires because the view was loaded and the logic is pointless. struct ContentView: View { @State var initialSelection: SomeView? @State var secondColumnShown = false var body: some View { NavigationView { SideBar(selected: $initialSelection) initialSelection?.view .onAppear(perform: { secondColumnShown = true }) } .navigationViewStyle(.columns) } } Is there a way to force the draw open for it to trigger the selection of the NavigationLink? Or is there some better logic I can use to only set the initialSelection view if it's on a small screen and the draw hasn't been shown? I've been battling this for a long time, and there's many stack overflow questions about this but no solutions that I can get to work on iOS 15
0
1
1.6k
Oct ’21
Swift availability check for Mac Catalyst is failing!
I have added an iOS 15+ function to my app and now it is crashing on my M1 iMac running in iPad Mac Catalyst mode on macOS 11.6. Could this be a potential bug in macOS, Xcode or Swift? I have this code: if #available(iOS 15.0, macCatalyst 15.0, *) { dataSource.applySnapshotUsingReloadData(fullSnapshot, completion: nil) } else { dataSource.apply(fullSnapshot, animatingDifferences: false) } When I run it on my mac, I can see it is running thinking it is iOS 14.7 using print(UIDevice.current.systemVersion) however it runs the code within the available check and crashes because it is not available on my macOS version yet! I have tried using this code too: #if targetEnvironment(macCatalyst)             print("HERE") #else             print("HERE2") #endif and it prints HERE2 in the console! I don't see how this is possible?
4
1
4.7k
Oct ’21
SwiftUI size to fit Font using GeometryReader, font is too big
I am using GeometryReader to calculate the size of font to use to fit several lines of text, however it is always too big. What can be wrong with my calculation? Here's a simply Playground import SwiftUI import PlaygroundSupport struct MainView : View { var body: some View { VStack { SomeView() .frame(width: 508.0, height: 246.5) } } } struct SomeView: View { let newData = ["1", "2", "3", "4", "5", "6", "7", "8"] var lines: Int { newData.count } var body: some View { GeometryReader { geometry in VStack(alignment: .leading, spacing: 0) { ForEach(0..<lines) { idx in Text(newData[idx]) .padding(0) } } .font(.system(size: geometry.size.height / CGFloat(lines))) .onAppear { print(geometry.size) print(lines) print(geometry.size.height / CGFloat(lines)) } } } } PlaygroundPage.current.setLiveView(MainView()) This gives me this result which I need to show all 8 lines:  The GeometryReader correctly reports the height of the box to be 246.5 and the number of lines to be 8 which results in a 30.8125 font size. It seems the font size needs some additional padding but how do I calculate this? I want to be able to supply an unknown amount of data and have it fill the box. (Well I am actually using a LazyVGrid which is suffering the same issue).
0
0
1.8k
Sep ’21
My Widget Extension will not build with Bitcode
I have just updated my iMac to an M1 and now one of my projects is giving me these warnings for 3 of the libraries embedded in a Widget Extension: ld: warning: all bitcode will be dropped because '/Users/..../DJSwiftHelpers_Extension' was built without bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. I understand that the app needs all libraries to be built with bitcode in order to be bitcode compatible. 2 of the libraries are my own, one in fact is actually built inside the same project and all have bitcode enabled. The libraries have 2 versions, 1 with "Allow app extension safe API only" and the other without. It's only the app extension libraries that are an issue. Those embedded in a Watch extension are fine. Those embedded in Intents are fine. It's just the Widget extension that complains so I don't think the issue is the Frameworks. I can clear the warnings by disabling bitcode for the Widget Extension, however on uploading the app to the App Store, bitcode is in fact disabled for the whole app. So I guess my questions are: Why has this only become an issue on an M1 mac and not on my Intel Mac? Can widget extensions support bitcode? Or is the bitcode setting just ignored? Is it really impossible to use bitcode when providing a Widget Extension?
3
0
3.2k
Sep ’21