Post

Replies

Boosts

Views

Activity

Equal width buttons in VStack
I can't wrap my head around how to make two buttons the same width, without resorting to ugly hacks like GeometryReader. What is otherwise easy to implement using UIStackView or AutoLayout, becomes a nightmare in SwiftUI. I tried the following, plus some other variations, but nothing works. What is the "official way" to make two vertically aligned buttons of the same width? 1) VStack(alignment: .leading) { Button("Short", action: {}) .frame(maxWidth: .infinity) Button("Long title", action: {}) .frame(maxWidth: .infinity) } .frame(maxWidth: .infinity) 2) VStack(alignment: .leading) { Button(action: {}) { Text("Short") .frame(maxWidth: .infinity) } Button(action: {}) { Text("Long title") .frame(maxWidth: .infinity) } } .frame(maxWidth: .infinity) 3) VStack(alignment: .leading) { Button(action: {}) { Text("Short") }.frame(maxWidth: .infinity) Button(action: {}) { Text("Long title") }.frame(maxWidth: .infinity) } .frame(maxWidth: .infinity)
3
0
219
Oct ’24
Xcode 15.0 crashes when uploading apps to App Store Connect
I'm trying to upload an app to AppStoreConnect but Xcode (15.0 release not beta) crashes while creating the IPA - I think it's at this step, as it happens very fast. The agreements are all accepted, I don't know what else should I do ?? Here's the log: ------------------------------------- Process: Xcode [2147] Path: /Applications/Xcode.app/Contents/MacOS/Xcode Identifier: com.apple.dt.Xcode Version: 15.0 (22265) Build Info: IDEApplication-22265000000000000~3 (15A240d) Code Type: ARM-64 (Native) Parent Process: launchd [1] User ID: 501 Date/Time: 2023-09-24 11:08:28.8476 +0300 OS Version: macOS 13.5.2 (22G91) Report Version: 12 Anonymous UUID: AC134C1E-4270-BC50-46BA-0FC5F300594C Time Awake Since Boot: 590 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: archive info plist lock Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6 Terminating Process: Xcode [2147] Application Specific Information: abort() called com.apple.main-thread Application Specific Signatures: NSInvalidArgumentException Application Specific Backtrace 0: 0 CoreFoundation 0x00000001a3543154 __exceptionPreprocess + 176 1 DVTFoundation 0x0000000102713e30 DVTFailureHintExceptionPreprocessor + 388 2 libobjc.A.dylib 0x00000001a30624d4 objc_exception_throw + 60 3 CoreFoundation 0x00000001a362d9b8 -[__NSCFString characterAtIndex:].cold.1 + 0 4 CoreFoundation 0x00000001a363ac10 -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0 5 CoreFoundation 0x00000001a3456ae0 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 320 6 CoreFoundation 0x00000001a3456974 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 52 7 IDEFoundation 0x0000000108a55ac8 -[IDEArchiveDistributionRecord dictionaryRepresentation] + 296 8 IDEFoundation 0x0000000108a37180 __31-[IDEArchive setDistributions:]_block_invoke + 16 9 DVTFoundation 0x000000010270bb2c -[NSArray(DVTFoundationClassAdditions) dvt_arrayByApplyingBlock:] + 224 10 IDEFoundation 0x0000000108a37110 -[IDEArchive setDistributions:] + 84 11 Foundation 0x00000001a440ad94 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 604 12 Foundation 0x00000001a4434f00 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 64 13 Foundation 0x00000001a444e42c _NSSetObjectValueAndNotify + 284 14 IDEFoundation 0x0000000108a36f08 __36-[IDEArchive addDistribution:error:]_block_invoke + 156 15 libdispatch.dylib 0x00000001a323c400 _dispatch_client_callout + 20 16 libdispatch.dylib 0x00000001a324b97c _dispatch_lane_barrier_sync_invoke_and_complete + 56 17 DVTFoundation 0x0000000102758014 DVTDispatchBarrierSync + 148 18 DVTFoundation 0x00000001027342b4 -[DVTDispatchLock performLockedBlock:] + 60 19 IDEFoundation 0x0000000108a36d30 -[IDEArchive addDistribution:error:] + 200 20 IDEFoundation 0x00000001086dc2f0 __35-[IDEDistributionUploadStep upload]_block_invoke.115 + 116 21 DVTFoundation 0x0000000102757330 __DVT_CALLING_CLIENT_BLOCK__ + 16 22 DVTFoundation 0x0000000102757b08 __DVTSyncPerformBlock_block_invoke + 68 23 CoreFoundation 0x00000001a34ca1d4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 28 24 CoreFoundation 0x00000001a34ca0e8 __CFRunLoopDoBlocks + 364 25 CoreFoundation 0x00000001a34c958c __CFRunLoopRun + 2432 26 CoreFoundation 0x00000001a34c84b8 CFRunLoopRunSpecific + 612 27 HIToolbox 0x00000001acd1adf0 RunCurrentEventLoopInMode + 292 28 HIToolbox 0x00000001acd1ac2c ReceiveNextEventCommon + 648 29 HIToolbox 0x00000001acd1a984 _BlockUntilNextEventMatchingListInModeWithFilter + 76 30 AppKit 0x00000001a66ef97c _DPSNextEvent + 636 31 AppKit 0x00000001a66eeb18 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716 32 DVTKit 0x0000000102fd8a9c -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 300 33 AppKit 0x00000001a66e2f7c -[NSApplication run] + 464 34 DVTKit 0x0000000102fd7cbc -[DVTApplication run] + 60 35 AppKit 0x00000001a66ba3cc NSApplicationMain + 880 36 dyld 0x00000001a3093f28 start + 2236 Application Specific Backtrace 1: 0 CoreFoundation 0x00000001a3543154 __exceptionPreprocess + 176 1 DVTFoundation 0x0000000102713e30 DVTFailureHintExceptionPreprocessor + 388 2 libobjc.A.dylib 0x00000001a30624d4 objc_exception_throw + 60 3 CoreFoundation 0x00000001a362d9b8 -[__NSCFString characterAtIndex:].cold.1 + 0 4 CoreFoundation 0x00000001a363ac10 -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0 5 CoreFoundation 0x00000001a3456ae0 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 320 6 CoreFoundation 0x00000001a3456974 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 52 7 IDEFoundation 0x0000000108a55ac8 -[IDEArchiveDistributionRecord dictionaryRepresentation] + 296 8 IDEFoundation 0x0000000108a37180 __31-[IDEArchive setDistributions:]_block_invoke + 16 9 DVTFoundation 0x000000010270bb2c -[NSArray(DVTFoundationClassAdditions) dvt_arrayByApplyingBlock:] + 224 10 IDEFoundation 0x0000000108a37110 -[IDEArchive setDistributions:] + 84 11 Foundation 0x00000001a440ad94 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 604 12 Foundation 0x00000001a4434f00 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 64 13 Foundation 0x00000001a444e42c _NSSetObjectValueAndNotify + 284 14 IDEFoundation 0x0000000108a36f08 __36-[IDEArchive
9
2
3.2k
Sep ’23
How to implement a search bar above the keyboard like Safari on iPad
How can I insert a UISearchBar in the middle of the shortcuts bar displayed above the keyboard on iPad? You insert custom shortcuts in the shortcuts bar using 'someTextField.inputAssistantItem' with 'leadingBarButtonGroups' or 'trailingBarButtonGroups' properties, but it has no 'middleBarButtonGroups'. If I add the search bar as 'inputAccessoryView', like 'someTextField.inputAccessoryView = UISearchBar()' it is added above the shortcuts bar.
0
1
516
Aug ’23
How to symbolicate macCatalyst X86-64 crash files on M1/2
Got some crashes in Xcode Organizer from a macCatalyst app and they are not symbolicated. The crashes are from an X86-64 machine, and my work machine is M1. When trying to symbolicate them in Organizer I get an error: "Unable to Symbolicate Crash - An error occurred attempting to symbolicate crash. Unable to locate dSYMs for ...". It makes sense, as I only run the app on M1, and maybe the X86-64 was not built on this machine. I then went to download the dSYM file from AppStoreConnect/TestFlight/Build Metadata, but there is no "Download dSYM" link, even though the app page says "Includes Symbols Yes". I then tried to compile the app for "AnyMac (Mac Catalyst, Apple Silicon, Intel)", and now I get a binary with two images, the arm64 and the x86, but the UUID of x86 image is different than the one from the crash file. How can I get the original dSYM to symbolicate crashes from production?
0
0
510
Aug ’23
TextKit2 vs TextKit1 memory usage
I'm working on an app displaying a few hundred custom labels. The custom label is modelled after UILabel. When I implement the custom label using TextKit, the app is using about 0.5 GB of memory. When I implement it using TextKit2, it takes about 1.2 GB. Did anyone notice such a big difference in memory usage between TextKit and TextKit2? For how long will TextKit be around before being deprecated?
1
0
629
Aug ’23
'Perform' is never called from iOS17 Widget
I have created a widget and added a button in its body like this: Button("Tap me: ", intent: TaskIntent()). If I compile the TaskIntent in both the app and the widget, when tapping the button, it open the app and that's all, 'perform' is not called at all. If I compile the TaskIntent only in the widget, when tapping the button, it does nothing, 'perform' is not called either. Is there any special sauce needed to run the 'perform' of the AppIntent attach to the button?
1
1
764
Aug ’23
Xcode 14 Automatic signing failed
I have added Siri capability for an iOS/MacCatalyst app in Xcode. The app compiles just fine for iOS, but when compiling for MacCatalyst I get the error: “/Volumes/xdrive/M2/M2.xcodeproj Provisioning profile "Mac Catalyst Team Provisioning Profile: com.anotherview.M2.mac" doesn't include the com.apple.developer.siri entitlement. ” On the “Signing & Capabilities” page I get the error: “Automatic signing failed Xcode failed to provision this target. Please file a bug report at https://feedbackassistant.apple.com and include the Update Signing report from the Report navigator.” How can I add Siri capabilities on a Mac Catalyst app?
0
0
868
Aug ’23
Official instruction for installing iOS 17.0 beta 2 and visionOS 1.0 in Xcode 15 beta 2
I downloaded the simulators, opened the DMGs, and copied them to the library. Then I start Xcode and it enters an infinite loop of "Cannot open because unverified...". I keep pressing "Open Anyway" in the Settings app, it keeps telling me "Cannot open because unverified blah blah...". I tried following the hints in this thread (https://developer.apple.com/forums/thread/732324) but no luck, I only wasted hours of work So, Apple, how to install visionOS 1.0 in Xcode 15 beta 2, such a way that it works??
0
0
508
Jul ’23
Prevent creating "Default configuration" scene on macCatalyst at startup
I want to create an Welcome window for my app to show it at the first launch. While this window is visible, no other window/scene should be created. The user should click a "Continue" button to be able to use the app, and create new scenes. I defined two scenes, "Default Configuration" and "Welcome", and at the end of "application(_ :willFinishLaunchingWithOptions:)" I display the Welcome scene. It works ok, but a default scene is also created at startup while the Welcome window/scene is visible. I also tried using a macOS plugin. I defined the Welcome window in a xib in the plugin, and launched it from there. I did set "Visible at Launch", but that did not prevent a second scene to be created at startup, with the "Default Configuration". How can I temporarily prevent new scenes to be created?
3
0
939
Aug ’22
Incorrect scene is activated on opening handoff user activity on macCatalyst
I have a doc app consisting of two types of scenes, "Default Configuration" and "About". When an about scene is created, I set its activation condition to NO, so it does not get activated for any userActivity or URLContext: scene?.activationConditions.canActivateForTargetContentIdentifierPredicate = NSPredicate(value: false) Now, I open an about scene and some default configuration scenes. If the about scene is on top, then when opening a handoff user activity, this about scene gets activated instead of the default ones, or a new default scene being created. If the about scene is in background or it is not created, a correct default scene is activated and passed the activity. Opening documents from finder works fine in both cases, a default scene is activated and it gets URLContext objects. Is this the expected behaviour? I found a workaround but it feels like a workaround. I enable activation on the about scene: scene?.activationConditions.canActivateForTargetContentIdentifierPredicate = NSPredicate(value: false) Then in the about scene, I listen to scene(_:userActivity:), get the activity when it gets activated, pass it to UIApplication.shared.delegate, which in turn requests a new scene activation and passes the activity object to this new scene. In this case, a scene with the correct default configuration gets activated. I'm running the tests on macOS 12.4 if it matters.
1
0
688
Aug ’22
Named pasteboard not working on MacCatalyst
Hi, I'm storing a string on a named UIPasteboard, and when reading it back, it comes as nil. It works fine on iOS, but on MacCatalyst it always returns nil. I store it like that: let p = UIPasteboard(name: UIPasteboard.Name(rawValue: "aaa"), create: true)! p.string = "some text" print("hasStrings: \(p.hasStrings)") // hasStrings: true and I read it like that: let p = UIPasteboard(name: UIPasteboard.Name(rawValue: "aaa"), create: false)! print("hasStrings: \(p.hasStrings)") // hasStrings: false I'm running the two pieces of code from two different methods of a UIViewController. Say I store the string in 'viewWillAppear', and read it back in 'viewDidAppear'.
1
0
879
Mar ’22
Disable the focus system for a MacCatalyst app
I'm building a MacCatalyst app, where the Tab key is used for a special functionality within the app. For that, I inserted a UIKeyCommand in the main menu for "\t". When I press Tab, the default functionality takes over, and the focus moves to a button in the toolbar and stays there, which I don't want. As a result, the action of my key command is not called. I set tabKeyCommand.wantsPriorityOverSystemBehavior = true, but it makes no difference. The root view controller of my app is an UISplitViewController. I overloaded 'shouldUpdateFocus(in:)' and always return false hoping that this will disable moving the focus for the whole app, but it's not working. It looks like it's more difficult then needed. How can I instruct the system to not interfere with the Tab key?
0
0
992
Feb ’22