Post

Replies

Boosts

Views

Activity

App Record Creation Error with Organizer
I've been trying to send an archive with Organizer to iTunes Connect. It's not my first time. I've been doing it for more than a decade. Anyway, when I try to send a package for my new macOS application, Organizer gives me two error messages that I have never seen before. App Record Creation Error App Record Creation failed due to an invalid attribute. The SKU you entered has already been used. App Record Creation Error App Record Creation failed due to request containing an attribute already in use. The app name you entered is already being used for another app in your account. If you would like to use the name for this app you will need to submit an update to your other app to change the name, or remove it from App Store Connect. An odd thing is that, as shown in the screenshot below, Organizer demands that I enter an application name and SKU manually. I've entered the exactly same ones from the App Store Connect page. I didn't see this step on Organizer last month. I'm using a new SKU for this submission. And I don't have an existing application at iTunes Connect with the same application name. I guess it's the same issue that has been reported here.. I have no pending contract issues. How do I send an archive without errors? My Xcode version is Version 16.4 (16F6). Thanks.
4
0
246
Sep ’25
Image Miniaturization Issue
I have three toolbar buttons with images from Assets.xcassets. Initially, I didn't use @1x, @2x, @3x sizes. I just put one size (72 x 72) for all of them. It was never a problem till a few days ago. The reviewer has reported numerous issues, which all seem to originate from miniaturized toolbar images. They have given me a screenshot from an iPad. Now, each of the three to the left has shrunken to 4 x 4, according to them. Some lines of code are the following. import SwiftUI struct ContentView: View { var body: some View { NavigationStack { ZStack { VStack { ... ... ... } .background(.brown) .navigationBarTitleDisplayMode(.inline) .navigationBarItems( leading: HStack(content: { Button { } label: { Image("ToolbarImage1") .resizable() .foregroundColor(.red) .aspectRatio(contentMode: .fit) .frame(width: 28) } Button { } label: { Image("ToolbarImage2") .resizable() .foregroundColor(.cyan) .aspectRatio(contentMode: .fit) .frame(width: 28) } Button { } label: { Image("ToolbarImage3") .resizable() .foregroundColor(.gray) .aspectRatio(contentMode: .fit) .frame(width: 28) } }), trailing: HStack(content: { Button { } label: { Text("X") .font(.body) .fontWeight(.semibold) .foregroundStyle(colorScheme == .light ? .white : .black) .frame(width: 28, height: 28) .background { Circle() .fill(!disableGroupMenu ? .green : .green.opacity(0.6)) } } Button { withAnimation(.easeInOut(duration: 0.2)) { showCopyMenu.toggle() manageMenu() } } label: { Text("Y") .font(.body) .fontWeight(.semibold) .foregroundStyle(colorScheme == .light ? .white : .black) .frame(width: 28, height: 28) .background { Circle() .fill(!disableCopyMenu ? .indigo: .indigo.opacity(0.6)) } } }) ) .toolbar { ToolbarItem(placement: .principal) { Text("App name") .bold() .foregroundColor(.white) } } } } } } I don't see this minituralization issue on any of my actual devices (iPhone XR, iPhone 14, iPad 9th gen.) on top of various simulator models including iPad A16 with iOS 26. This is my first iOS submission after iOS 26 was released. I don't know if it has something to do with iOS 26. The reviewer hasn't told me about their iPad model or the iOS version. I have the same app for macOS, which was submitted after macOS 26 was released. And they haven't reported the miniaturization issue after 4 or 5 software updates. If you have any idea as to what's causing it, please let me know. I have submitted a new binary with @3x as a resort. I doubt the issue has been resolved. Thanks. Initally, I've used Xcode 16.4 to built the app. I have tried building it with Xcode 26. And I don't see the minituralization issue on any of the simulator models (iPad mini, iPad A16...).
Topic: UI Frameworks SubTopic: SwiftUI
3
0
119
Oct ’25
Opening an NSViewController as a Sheet
I have a SwiftUI desktop application. And I need to open a window sheet from a storyboard with a click of a button, which works. But I have a problem. The opening window sheet is very big. Its size is 1,400 x 300 pixels. (I don't know the exact height.) I don't know where this size comes from. But I need to make it smaller. If I try to do it with the view controller, it doesn't work. How can I control the opening window sheet size? // SwiftUI View // import SwiftUI struct ContentView: View { &#9;&#9;@State private var sheetPresented = false &#9;&#9;@State private var selectionIndex = 3 &#9;&#9; &#9;&#9;var body: some View { &#9;&#9;&#9;&#9;ZStack { &#9;&#9;&#9;&#9;&#9;&#9;VStack { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;Button(action: { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;sheetPresented = true &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;}) { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;Text("Show me a sheet") &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;.sheet(isPresented: $sheetPresented) { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;SheetViewControllerRepresentation(message: String(selectionIndex)) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;}.frame(minWidth: 360, idealWidth: 360, maxWidth: 360, minHeight: 240, idealHeight: 240, maxHeight: 240, alignment: .center) &#9;&#9;} } // View controller // import Cocoa import SwiftUI class SheetViewController: NSViewController { &#9;&#9;// MARK: - &#9;&#9;var message = String() &#9;&#9;&#9;&#9; &#9;&#9;// MARK: - IBOutlet &#9;&#9;@IBOutlet weak var messageLabel: NSTextField! &#9;&#9;// MARK: - IBAction&#9;&#9; &#9;&#9;@IBAction func closeClicked(_ sender: NSButton) { &#9;&#9;&#9;&#9;/* closing window */ &#9;&#9;&#9;&#9;self.view.window?.setIsVisible(false) &#9;&#9;&#9;&#9;self.view.window?.close() &#9;&#9;} &#9;&#9;// MARK: - Life cycle &#9;&#9;override func viewDidLoad() { &#9;&#9;&#9;&#9;super.viewDidLoad() &#9;&#9;&#9;&#9;// Do view setup here. &#9;&#9;} &#9;&#9; &#9;&#9;override func viewWillAppear() { &#9;&#9;&#9;&#9;super.viewWillAppear() &#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;messageLabel.stringValue = message &#9;&#9;} &#9;&#9; &#9;&#9;override func viewDidAppear() { &#9;&#9;&#9;&#9;super.viewDidAppear() &#9;&#9;&#9;&#9; &#9;&#9;&#9;&#9;view.setFrameSize(CGSize(width: 320, height: 220)) &#9;&#9;} } struct SheetViewControllerRepresentation: NSViewControllerRepresentable { &#9;&#9;var message = String() &#9;&#9; &#9;&#9;func makeNSViewController(context: NSViewControllerRepresentableContext<SheetViewControllerRepresentation>) -> SheetViewController { &#9;&#9;&#9;&#9;let mainStoryboard = NSStoryboard(name: "Main", bundle: nil) &#9;&#9;&#9;&#9;let sheetViewController = mainStoryboard.instantiateController(withIdentifier: "SheetView") as! SheetViewController &#9;&#9;&#9;&#9;sheetViewController.message = self.message &#9;&#9;&#9;&#9;return sheetViewController &#9;&#9;} &#9;&#9; &#9;&#9;func updateNSViewController(_ nsViewController: SheetViewController, context: NSViewControllerRepresentableContext<SheetViewControllerRepresentation>) { &#9;&#9;} } Thank you.
4
0
1.1k
Dec ’20
Using TestFlight Before Submission?
Hello. I'm a little bit confused about how TestFlight works. If I have an iOS app under development that has not been in the store and that has not been submitted for a review yet, can I use TestFlight to have it tested by my development team? I know that there are two types of tests, internal tests and external tests. It seems that you can use TestFlight for internal tests even if the app has not been submitted for a review. Thanks.
1
0
688
Jun ’21
Value of type 'UIView?' has no member 'isEnabled'
I have the following lines of code in practicing Combine. import UIKit import Combine class ViewController: UIViewController { // MARK: - Variables var cancellable: AnyCancellable? @Published var segmentNumber: Int = 0 // MARK: - IBOutlet @IBOutlet weak var actionButton: UIButton! // MARK: - IBAction @IBAction func segmentChanged(_ sender: UISegmentedControl) { segmentNumber = sender.selectedSegmentIndex } // MARK: - Life cycle override func viewDidLoad() { super.viewDidLoad() cancellable = $segmentNumber.receive(on: DispatchQueue.main) .assign(to: \.isEnabled, on: actionButton) } } I get an error at .assign that says Value of type 'UIView?' has no member 'isEnabled' What am I doing wrong? Thank you.
3
0
2.5k
Aug ’21
Practical Use of Combine's Subject
I'm trying to understand how Combine works. The following is my sample code. import UIKit import Combine class ViewController: UIViewController { // MARK: - Variables var cancellable: AnyCancellable? // MARK: - IBAction @IBAction func buttonTapped(_ sender: UIButton) { currentValueSubject.send(20) } // MARK: - Life cycle var currentValueSubject = CurrentValueSubject<Int, Never>(1) override func viewDidLoad() { super.viewDidLoad() let cancellable = currentValueSubject .sink { value in print("New value: \(value)") } currentValueSubject.send(5) currentValueSubject.send(10) //currentValueSubject.send(completion: .finished) currentValueSubject.send(15) //cancellable.cancel() } } If I run it with the iPhone simulator, I get New value: 1 New value: 5 New value: 10 New value: 15 If I tap the button, the app won't get a new value. I suppose that's because the subscription is cancelled at the end of viewDidLoad? If so, why does it get cancelled? I don't quite see a practical side of Combine's Subject. When is it useful? Thanks.
2
0
1.1k
Aug ’21
Navigation title with LayoutConstraints Warnings in Console
I just want to show a simple navigation title like the following. import SwiftUI struct ContentView: View { var body: some View { NavigationView { ZStack { Color.red.edgesIgnoringSafeArea(.all) Text("Hello") } .navigationTitle("GGG") .navigationBarTitleDisplayMode(.inline) .navigationBarHidden(false) } } } And I get a bunch of mumbo jumbo auto-layout warnings (Unable to simultaneously satisfy constraints...) in Console. If I comment out the navigationTitle line, I won't get them. I have never seen those messages in showing a navigation title when writing code with UIKit. What am I doing wrong? Muchos thankos
1
0
546
Sep ’21
How to Use a Button in navigationBarItems to Work with List
I have the following lines of code to work with a list of strings. import SwiftUI struct ContentView: View { @State private var users = ["George", "Kenny", "Susan", "Natalie"] var body: some View { NavigationView { List { ForEach(users, id: \.self) { user in Text(user) } .onDelete(perform: delete) } .navigationBarTitle("My family") .toolbar { EditButton() } } } func delete(at offsets: IndexSet) { users.remove(atOffsets: offsets) } } Now, I'm doing the following out of curiosity. Now, I have a button in naviationBarItems. And I wonder if I can turn on and off the edit feature of the list with the button? struct ContentView: View { @State private var users = ["George", "Kenny", "Susan", "Natalie"] var body: some View { NavigationView { List { ForEach(users, id: \.self) { user in Text(user) } } .navigationBarTitle("My family") .navigationBarItems(trailing: Button(action: { print("Edit button pressed...") }) { Text("Edit") } ) } } } Muchos thankos.
1
0
510
Sep ’21
Toggling Values on EnvironmentValue (EditMode)
I have the following lines of code for showing a list of friends. import SwiftUI struct ContentView: View { @State var users = ["Susan", "Kate", "Natalie", "Kimberly", "Taylor", "Sarah", "Nancy", "Katherine", "Nicole", "Linda", "Jane", "Mary", "Olivia", "Barbara"] @State var editMode = EditMode.inactive var body: some View { NavigationView { List { ForEach(users, id: \.self) { user in Text(user) } } .navigationBarTitle("Friends") .environment(\.editMode, $editMode) .navigationBarItems(leading: Button("Edit", action: { if self.editMode == .active { self.editMode = .inactive } else { self.editMode = .active } })) } } } If you see the code at the bottom, I have four lines just in order to change the value of editMode. Does SwiftUI have something like showDetails.toggle() where showDetails is a Boolean variable? Muchos thankos.
3
0
562
Sep ’21
SwiftUI - What is Identifiable?
I have the following simple lines of code. import SwiftUI struct ContentView: View { var users = ["Susan", "Kate", "Natalie", "Kimberly", "Taylor", "Sarah", "Nancy", "Katherine", "Nicole", "Linda", "Jane", "Mary", "Olivia", "Barbara"] var body: some View { List { ForEach(users, id: \.self) { user in Text(user) } } } } So I'm just listing names. What I want to ask is what is id and what .self means. If I look up the doc under ForEach, it says the following. Either the collection’s elements must conform to Identifiable or you need to provide an id parameter to the ForEachinitializer. Does the compiler automatically generate a unique string like UUID for each element in the array or something? Can I somehow print the raw value of each id? Muchos thankos.
1
0
3.4k
Sep ’21
Why Do We Need to Specify Schedule?
Hola, I have the following simple lines of code. import UIKit import Combine class ViewController: UIViewController { // MARK: - Variables var cancellable: AnyCancellable? @Published var labelValue: String? // MARK: - IBOutlet @IBOutlet weak var textLabel: UILabel! // MARK: - IBAction @IBAction func actionTapped(_ sender: UIButton) { labelValue = "Jim is missing" } // MARK: - Life cycle override func viewDidLoad() { super.viewDidLoad() cancellable = $labelValue .receive(on: DispatchQueue.main) .assign(to: \.text, on: textLabel) } } I just wonder what is the point of specifying the main thread with .receive? If I comment out the receive line, the app will still run without a problem. Muchos thankos
1
0
632
Oct ’21
Observing UIButton Tap with Combine?
Let me say that I have an IBOutlet object like @IBOutlet weak var deleteButton: UIButton! RxCocoa can make this button tap observable like deleteButton.rx.tap It doesn't look like Combine lets us observe a button tap. Am I right? I find one approach found at the following URL. https://www.avanderlee.com/swift/custom-combine-publisher/ And Combine has no native approach? And you still have to use the IBAction?
1
0
2.7k
Oct ’21
Keeping Track of Text Changes over Two Text Fields
I'm still a beginner in using Combine. I practice it on and off. Anyway, I have a view model to see changes in two text fields in my view controller as follows. // ViewModel // import Foundation import Combine class LoginViewModel { var cancellable = [AnyCancellable]() init(username: String, password: String) { myUsername = username myPassword = password } @Published var myUsername: String? @Published var myPassword: String? func validateUser() { print("\(myUsername)") print("\(myPassword)") } } And my view controller goes as follows. // ViewController // import UIKit import Combine class HomeViewController: UIViewController { // MARK: - Variables var cancellable: AnyCancellable? // MARK: - IBOutlet @IBOutlet var usernameTextField: UITextField! @IBOutlet var passwordTextField: UITextField! // MARK: - Life cycle override func viewDidLoad() { super.viewDidLoad() cancellable = NotificationCenter.default.publisher(for: UITextField.textDidChangeNotification, object: usernameTextField) .sink(receiveValue: { result in if let textField = result.object as? UITextField { if let text = textField.text { let loginViewModel = LoginViewModel(username: text, password: "") loginViewModel.validateUser() } } }) } } So I use NSNotification as a publisher to see text changes over one of the text fields. And I cannot see text changes over two of them at the same time. Is there a better approach in seeing text changes over two text fields at the same time using Combine? Muchos thankos.
3
0
2.2k
Oct ’21
Observing Changes in Multiple @Published Variables at the Same Time?
I have the following lines of code to subscribe text changes over two text fields. import UIKit import Combine class ViewController: UIViewController { var cancellables = Set<AnyCancellable>() @Published var userText: String = "" @Published var passText: String = "" // MARK: - IBOutlet @IBOutlet var usernameTextField: UITextField! @IBOutlet var passwordTextField: UITextField! // MARK: - Life cycle override func viewDidLoad() { super.viewDidLoad() NotificationCenter.default.publisher(for: UITextField.textDidChangeNotification, object: usernameTextField) .sink(receiveValue: { (result) in if let myField = result.object as? UITextField { if let text = myField.text { self.userText = text } } }) .store(in: &cancellables) NotificationCenter.default.publisher(for: UITextField.textDidChangeNotification, object: passwordTextField) .sink(receiveValue: { (result) in if let myField = result.object as? UITextField { if let text = myField.text { self.passText = text } } }) .store(in: &cancellables) $userText .sink(receiveValue: { text in print(text) }) .store(in: &cancellables) } } In the last several lines, I am printing the text change for userText. Does Combine allow me to observe two variables (userText, passText) at the same time so that I can plug them into a function? If yes, how? Muchos Thankos.
1
0
1.9k
Nov ’21
Using URLSession in Combine
I'm trying to figure out how to use URLSession with the Combine framework. I have a class that is to fetch data as follows. import UIKit import Combine class APIClient: NSObject { var cancellables = [AnyCancellable]() @Published var models = [MyModel]() func fetchData(urlStr: String) -> AnyPublisher<[MyModel], Never> { guard let url = URL(string: urlStr) else { let subject = CurrentValueSubject<[MyModel], Never>([]) return subject.eraseToAnyPublisher() } let subject = CurrentValueSubject<[MyModel], Never>(models) URLSession.shared.dataTaskPublisher(for: url) .map { $0.data } .decode(type: [MyModel].self, decoder: JSONDecoder()) .replaceError(with: []) .sink { posts in print("api client: \(posts.count)") self.models = posts } .store(in: &cancellables) return subject.eraseToAnyPublisher() } } I then have a view model class that is to deliver data for my view controller as follows. import Foundation import Combine class ViewModel: NSObject { @IBOutlet var apiClient: APIClient! var cancellables = Set<AnyCancellable>() @Published var dataModels = [MyModel]() func getGitData() -> AnyPublisher<[MyModel], Never> { let urlStr = "https://api.github.com/repos/ReactiveX/RxSwift/events" let subject = CurrentValueSubject<[MyModel], Never>(dataModels) apiClient.fetchData(urlStr: urlStr) .sink { result in print("view model: \(result.count)") self.dataModels = result }.store(in: &cancellables) return subject.eraseToAnyPublisher() } } My view controller has an IBOutlet of ViewModel. import UIKit import Combine class ViewController: UIViewController { // MARK: - Variables var cancellables = [AnyCancellable]() @IBOutlet var viewModel: ViewModel! // MARK: - IBOutlet @IBOutlet weak var tableView: UITableView! // MARK: - Life cycle override func viewDidLoad() { super.viewDidLoad() viewModel.getGitData() .sink { posts in print("view controller: \(posts.count)") } .store(in: &cancellables) } } If I run it, it seems that ViewModel returns 0 without waiting for APIClient to return data. And the view controller doesn't wait, either. What am I doing wrong? Can I do it without using the completion handler? In case you need to know what MyModel is, it's a simple struct. struct MyModel: Decodable { let id: String let type: String } Muchos thanks
3
0
1.7k
Nov ’21