Post

Replies

Boosts

Views

Activity

Reply to Help, I'm New and Lot
Welcome to the forum Warren85. It is hard to say with such limited information. You should read this to get tips on how to post on the forum: https://developer.apple.com/forums/thread/706527 This being said, please tell: Is it an iOS app (for iPhone / iPad) ? Is it SwiftUI ? Show the code of the app (ContentView if SwiftUI), we shall help you. Or at list the part where the initial content should show on simulator.
23h
Reply to Setting the highlight colour of a selected cell in NSTableView
Thanks for reply.   You definitely wouldn't want to change the highlight style in "viewFor". Maybe do that in viewDidLoad or something. What's the issue ?   There's more than one way to do this. One would be enough Anyway, I change my mind to stay consistent with system behaviour and will change the color of the text (to white) when selected, to make it more readable.
Topic: UI Frameworks SubTopic: AppKit Tags:
4d
Reply to Can we decode twice in the same session with unarchiver?
Thanks for the reply. I tried to replace if let result = unarchiver.decodeObject(of: [/* list */], forKey: someKey) as? someClass { by do { let result = try unarchiver.decodeTopLevelObject(of: [/* list */], forKey: someKey) as! someClass It compiles but does not decode: I get a failure on log : unarchiving failed And with this pattern, I do not know how to test the "double call" within the print Is it an error to use unarchiver.decodeObject ? What can be the side effects ? unarchiver.decodeObject(of: [/* list */], forKey: someKey)
Topic: App & System Services SubTopic: General Tags:
6d
Reply to How to solve this NSKeyedArchiver warning
SOLVED. I did log a message before each call of decoder.decodeObject(of: key:) That let me find the issue, and replace: self.aVar = decoder.decodeObject(of: NSArray.self, forKey: someKey) as? someClass by self.aVar = decoder.decodeObject(of: [NSArray.self, NSSet.self, NSNumber.self], forKey: someKey) as? someClass   Effectively, someClass has properties that have NSSet properties as well as Int. That was my error, but I still think that Xcode should be able to guess this and provide clearer messages or propose autocompletion. Not yet the case in Xcode 16.4 nor 26.2. I'll file a bug report for enhancement.
Topic: App & System Services SubTopic: General Tags:
1w
Reply to How to solve this NSKeyedArchiver warning
Thanks Albert for replying.   Is it an array where you use NSKeyedUnarchiver validateAllowedClass:forKey:? I have a lot of classes with SecureCoding, and I cannot find from the warning in the log where it comes from. What is surprising is that I have commented out all the NSNumber.self in any list of decoder.decodeObject(of:, key:) like if let format = decoder.decodeObject(of: [NSArray.self/*, NSNumber.self*/], forKey: formatKey) as? [[Int]] { And still get the log. *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSNumber' (0x204cdbeb8) [/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects', even though it was not explicitly included in the client allowed classes set: '{( "'NSArray' (0x204cd5598) [/System/Library/Frameworks/CoreFoundation.framework]" )}'. This will be disallowed in the future. *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSNumber' (0x204cdbeb8) [/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects', even though it was not explicitly included in the client allowed classes set: '{( "'NSArray' (0x204cd5598) [/System/Library/Frameworks/CoreFoundation.framework]" )}'. This will be disallowed in the future. So the questions: does the alert ask to include NSNumber.self in some decoder.decodeObject(of:) ? How can I find where the message triggers ? I will try to locate by setting breakpoints at decoder.decodeObject(of:, key:) calls, but there maybe a simpler way ? PS: this new API for secure coding makes it really difficult. It would be great if Xcode could propose the list of Types to include in decoder.decodeObject(of:, key:).
Topic: App & System Services SubTopic: General Tags:
1w
Reply to How to encode / decode Array < Array < SomeStruct > >
I have tried also: if let format = decoder.decodeObject(of: Array<any AnyObject.Type>.self, forKey: someKey) { I get the compiler error: Cannot convert value of type 'Array<any AnyObject.Type>.Type' to expected argument type '[AnyClass]' (aka 'Array<any AnyObject.Type>')   I then tried if let format = decoder.decodeObject(of: [AnyClass].self, forKey: someKey) { and got Cannot convert value of type '[AnyClass].Type' (aka 'Array<any AnyObject.Type>.Type') to expected argument type '[AnyClass]' (aka 'Array<any AnyObject.Type>')    And a last try: if let formatI = decoder.decodeObject(of: [AnyClass], forKey: someKey) { and got Cannot convert value of type '[AnyClass].Type' (aka 'Array<any AnyObject.Type>.Type') to expected argument type '[AnyClass]' (aka 'Array<any AnyObject.Type>')   What should I pass as of: argument?
Topic: App & System Services SubTopic: General Tags:
1w
Reply to App Store Connect rejects screenshot upload: “incorrect size” (subscription purchase flow) — tried all documented sizes
Welcome to the forums. So just select a simulator in Xcode for iPhone and iPad (e.g., iPhone 16 Plus 6.7" and iPad Air 13") and run the app on them. The screenshots generated by the simulator (cmd-S) will provide the right sized images. Note that you have to provide only one size for iPhone and one size for iPad.
1w
Reply to NSKeyedArchiving issue
Hey Quinn, thanks for all the material. I realize that I have a basic issue in my code. data is not loaded. In the previous version, archiver had a connection to data let archiver = NSKeyedArchiver(forWritingWith: data) That's no more the case, so data is empty, hence the problems. let data = NSMutableData() let archiver = NSKeyedArchiver(requiringSecureCoding: true) archiver.encode(myObject, forKey: theKey) archiver.encode(myObject2, forKey: theKey2) archiver.finishEncoding() do { try data.write(to: an uRL, options: []) // data is empty of course ! } catch { } So should I replace: archiver.encode(myObject, forKey: theKey) archiver.encode(myObject2, forKey: theKey2) archiver.finishEncoding() do { try data.write(to: anURL, options: []) // So object and object2 are on file with let data = try! NSKeyedArchiver.archivedData(withRootObject: myObject, requiringSecureCoding: true) let data2 = try! NSKeyedArchiver.archivedData(withRootObject: myObject2, requiringSecureCoding: true) archiver.finishEncoding() If so, how do I write object and object2 in a single file properly ? Would I have to include all in a single root class ? Also, when I compare to https://developer.apple.com/forums/thread/759746, my required init(coder decoder: NSCoder) is different. required init(coder decoder: NSCoder) { super.init() var1 = decoder.decodeObject(forKey: key) as? [someType] var2 = decoder.decodeObject(forKey: key2) as? [someType2] } I do not use decodeObject(of:) as in the reference let identifier = decoder.decodeObject(of: NSString.self, forKey: "identifier"), let codeDataModels = decoder.decodeArrayOfObjects(ofClass: CodeDataModel.self, forKey: "codeDataModels") Is it OK ?
Topic: App & System Services SubTopic: General Tags:
1w
Reply to Tools to create awesome "Previews and Screenshots" images.
It is very explicit in guidelines, if your Previews don't show real screenshots, the app risks being rejected. 2.3 ASR & NR Accurate Metadata.                  Customers should know what they’re getting when they download or buy your app, so make sure all your app metadata, including privacy information, your app description, screenshots, and previews accurately reflect the app’s core experience and remember to keep them up-to-date with new versions. You can add drawing in screenshot overlay: 2.3.3 Screenshots should show the app in use, and not merely the title art, login page, or splash screen. They may also include text and image overlays (e.g. to demonstrate input mechanisms, such as an animated touch point or Apple Pencil) and show extended functionality on device, such as Touch Bar. You can use AI to generate images to include in the app and they will show on screenshots. Or some image to partially overlay the screenshot. But not substitute to screenshots.   it just ignores the dimensions I tell it to use That's not the issue as it is so easy to resize to the exact dimensions. The issue is the content.
2w
Reply to App stuck in 'Ready for Distribution'
@petriniemela Welcome to the forum. How do you see your app is not distributed ? It does not appear on the AppStore ? Have you checked that you have set the countries for distribution properly (is Finland in your list) ? You answered in the comments (better to answer with a reply, more visible). Ready for distribution is the last stage, no need for more. Did you receive a mail notification ? If you still have issue, the best is to contact support. https://developer.apple.com/contact/ If you want someone else to check, could you give the name of your app ? Note: avoid duplicating posts.
2w