Post

Replies

Boosts

Views

Activity

Reply to How fix the package "%@"is missing or invalid
I cannot tell how long it would take. I found this reference to the same issue, with some advice, but I could not test it by myself. For 1 they propose to turn off wifi and then on again (but I doubt that could be the cause). This seems a more elaborate advice: https://discussions.apple.com/thread/252431443 Here are their advice: First, make sure all external devices are disconnected before trying to install. Then let's start to macOS Recovery and use Disk Utility to repair the hard drive. Here's how: How to repair a Mac disk with Disk Utility After the repair is complete, restart your Mac normally. Then you'll want to delete the macOS Big Sur install file and download it again. The install file can be found in the Applications folder and the Launchpad. If you're using any security software, be sure to disable or temporarily remove it so it doesn't interfere with the connection and download. May check also that you have no firewall : Some seem to have succeeded by starting in safe mode. read all ideas here : https://developer.apple.com/forums/thread/649819 Unfortunately, I'm not from Apple, there is nothing I can do to fix it. Wish all this will finally help.
Topic: App & System Services SubTopic: Core OS Tags:
May ’21
Reply to How fix the package "%@"is missing or invalid
May have a look here: https ://osxdaily. com/2020/11/12/macos-big-sur-update-download-errors/ “The package %@ is missing or invalid” Error Message Some users have encountered an error message stating  “The package %@ is missing or invalid” when attempting to download or upgrade to macOS Big Sur. This problem can sometimes be resolved by installing any available system software updates on the Mac first. Also, sometimes changing the wi-fi network (or turning off wi-fi if you’re on ethernet), and then deleting and re-downloading the macOS Big Sur installer can sometimes resolve the error.
Topic: App & System Services SubTopic: Core OS Tags:
May ’21
Reply to How to best handle this localization scenario?
So, you send back the button title probably, which is effectively localized Did you consider using buttons tags ? I would do this: 1) On app load, swift will pick up 6 random items from a strings array of 100 items. keep track of the index of each item selected 2) It will display each of those 6 strings on 6 user interface buttons. Set the button tag with the index you have used to set its title. 3) User will tap on a button: string value is sent back into app. send back the tag value instead. 4) App will do processing with this value. Problem is that all internal processing from that values that went out from the array on user interface then back in app, is all done with english values. In particular that user choice is saved in external database, and I can't have saved in database localized versions: all internal processing on array values in english. To do the processing, get back the string value from the array, using the index you received. If there are still problem, please explain. Otherwise, don't forget to close the thread on this answer. Goos continuation.
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to How to save and restore position of secondary NSViewController
Could you explain how and where you set the restoration ID (in storyboard ?). Do you mean 'Autosave' ? I found this old thread that explains there is a problem with autoSave when called from a segue (that seems to be your case): https://stackoverflow.com/questions/25150223/nswindowcontroller-autosave-using-storyboard I don't know if there is a better way, but the problem here is that when the AutosaveName is set in Interface Builder, and the Window is open via a Segue, the window is open at a predefined location and the frame is saved, overwriting the last saved frame... If you have a predefined position to the center of the screen, each time the window will be open, it will appear in the center and the position will be saved. To avoid this, I set the AutosaveName in the Window Controller (Not in IB), after restoring the saved Frame: class MyWindowController: NSWindowController { override func windowDidLoad() { super.windowDidLoad() let thewindow = window as! NSWindow /// restore position thewindow.setFrameUsingName("MyWindow") self.windowFrameAutosaveName = "MyWindow" } } Another way to do this and have it working even after closing the app, is to save position in UserSettings. And reuse it when opening.
Topic: UI Frameworks SubTopic: AppKit Tags:
May ’21
Reply to What is a scope ?
In the previous example, let's create a signIn button in storyboard, in the viewController. Connect (control drag) this button to the class code, just below the class declaration. Give the name signIn. You need also to create an action : control-drag again from the button in storyboard, to the code, and select Action. Give it a name like pressSignIn The button has not a 'declared' scope, it has a scope depending how it is declared. Type the new instructions as shown below You should get something like: class MyClass {     @IBOutlet weak var signIn: UIButton! // see the black dot at the left var classScopeVar = 1 // This is visible in the scope of the class     @IBAction func pressSignIn(_ sender: UIButton) { // button is in fact signIn print("Button pressed") print("It is signIn, which is visible in scope", signIn.titleLabel?.text ?? "") // We check the button is visible here // You could also have written: print("Sender", sender.titleLabel?.text ?? "") // The same result } func someFunc() { var funcScopeVar = 2 // This is only defined (hence visible) in the scope of the func print("classScopeVar", classScopeVar) print("funcScopeVar", funcScopeVar) print("I can also call from this func", signIn.titleLabel?.text ?? "") // We check the button is visible here // But the following would fail: print("Sender", sender.titleLabel?.text ?? "") // sender is not visible here, only in the IBAction func. So that will cause a compiler error. Comment out this line to be able to compile and run. } func otherFunc() { print("classScopeVar", classScopeVar) // This is visible in the scope of the class, hence it works print("funcScopeVar", funcScopeVar) // This is visible only in the scope of someFunc, hence compiler error here } } If that's OK, don't forget to close the thread on this answer. Otherwise, please explain what is still unclear for you.
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to UDID share or secure
I would not personally do it. Did they give you a valid reason to do so ? Do they want to enrol your device in their management system ? You could argue that you are, in your developer work, very concerned with safety, hence you avoid sharing such information. If really needed, get an iPhone on which you store nothing and don't share anything on iCloud. That will be your scape goat. It's a question of trust. may read this: https://discussions.apple.com/thread/7488759
Topic: App & System Services SubTopic: Core OS Tags:
May ’21
Reply to Problem with alert in iOS4.5
It effectively works correctly on 14.4 (not 4.4😉) simulator. The error speaks of splitView. I do not see it in the posted code. There are some issues with List. Could you try, just for testing, to replace List by VStack ? There seems to have been some change with 14.5: https://forums.swift.org/t/14-5-beta3-navigationlink-unexpected-pop/45279
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to What is a scope ?
Take this example class MyClass { var classScopeVar = 1 // This is visible in the scope of the class func someFunc() { var funcScopeVar = 2 // This is only defined (hence visible) in the scope of the func print("classScopeVar", classScopeVar) print("funcScopeVar", funcScopeVar) } func otherFunc() { print("classScopeVar", classScopeVar) // This is visible in the scope of the class, hence it works print("funcScopeVar", funcScopeVar) // This is visible only in the scope of someFunc, hence compiler error here } } So, in your case, check where you declared the button. If it is inside a func, it will not be visible outside of the func. You need to declare it at the class level most likely. If you have created a button in storyboard, you need to connect to an IBOutlet to reference it (control-drag from the button in storyboard to some place in the class ; the following will be automatically created once you give signIn as the name for the button): @IBOutlet weak var signIn: UIButton! Scope is also important because local declaration is considered in priority. If you write func yetAnotherFunc() { var classScopeVar = 3 // You redeclare a new var with the same name print("classScopeVar", classScopeVar) // You will get 3, not 1 // If you want to access the initial var print("real classScopeVar", self.classScopeVar) // You will get 1 }
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to How to best handle this localization scenario?
Is it possible from a localized french VALUE, to get corresponding VALUE in base language? You may have another way (I do not recommend, but it will require less change to your code). When you get the answer (in French or whatever language), build the array of localized strings from original array let localizedStrings = originalArray.map() { NSLocalizedString($0, comment: "") } Search for the answer and get the base string var baseAnswer = "" if let index = localizedStrings.firstIndex(of: answer) { baseAnswer = originalArray[index] } Do what you need with baseAnswer
Topic: Programming Languages SubTopic: Swift Tags:
May ’21