I need any kind of help I can get on this question and am open to any solutions or workarounds.
When I archive FileManager.ubiquityIdentityToken with NSKeyedArchiver.archivedData(withRootObject:requiringSecureCoding:), what should I set the second parameter to in order to be able to unarchive later, and how do I unarchive the Data object using unarchivedObject(ofClass:from:) or any other method of NSKeyedUnarchiver?
My code currently uses the deprecated method of archivedData(withRootObject:), which gives me a code time warning saying:
'archivedData(withRootObject:)' was deprecated in iOS 12.0: Use +archivedDataWithRootObject:requiringSecureCoding:error: instead
I'm getting code time error messages in red for the argument to archivedData(withRootObject:requiringSecureCoding:) which is declared as type Any. I tried different arguments. The one I this should work is (NSCoding & NSCopying & NSObject).Type, which generates two error messages:
Static method 'unarchivedObject(ofClass:from:)' requires that '(NSObject & NSCoding & NSCopying).Type' inherit from 'NSObject'
Type '(NSObject & NSCoding & NSCopying).Type' cannot conform to 'NSCoding'
Setting the argument to (NSCoding & NSCopying & NSObject) generates the error message:
'NSObject & NSCoding & NSCopying' cannot be used as a type conforming to protocol 'NSCoding' because 'NSCoding' has static requirements
I haven't been able to discover what that means that 'NSCoding' has static
I get the idea to use (NSCoding & NSCopying & NSObject) because when run code:
print("type of FileManager.default.ubiquityIdentityToken: \(type(of: FileManager.default.ubiquityIdentityToken))")
the debug window shows
type of FileManager.default.ubiquityIdentityToken: Optional<NSCoding & NSCopying & NSObject>
but when I run the following code
print("type of FileManager.default.ubiquityIdentityToken: \(type(of: FileManager.default.ubiquityIdentityToken!))")
I get the following in the debug window
type of FileManager.default.ubiquityIdentityToken: _NSInlineData
I read on stackoverflow that "_NSInlineData" is not made available to us by Apple.
I'm open to doing this any other way, not necessarily with NSKeyedArchiver or NSKeyedUnarchiver, including using unsafe pointers if necessary.
In one of Apple's documentation or sample Xcode projects, I found code to check the login status of a user on iOS when an app logs on by checking FileManager.ubiquityIdentityToken and to check the current status with the previous status by checking the ubiquityIdentityToken that was saved in UserDefaults. Is there a better way of doing this?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
When I go to the Shortcuts app and add an action, there is a tab that lets me see Apps that has actions I can use. How do I make my iOS app be able to contribute actions for users to use in a shortcut, so that a user creating a shortcut can add an action that does something in my app?
An example of this is the Walmart app. A user can create use an action that allows him to check in.
I am preparing to submit an app for the very first time.Why is the default version number 1.0? Doesn't that 0 get truncated? Would it be better if I changed the version number to 1? Would it make a difference?
How do I copy to file system or play with AVAudioPlayer an MPMediaItem that I get from an MPMediaPickerController initialized with type audio? When I try, I get an error that says:The file “item.mp3” couldn’t be opened because URL type ipod-library isn’t supported.
What does that mean in Xcode When the name of a swift file that is showing in the tab at the top in the editor window is italicized?
I'm curious why I don't see posts about Xcode crashing. Since I updated both macOS Monterey 12.6 and Xcode 14, Xcode repeatedly crashes, becoming more frequently, even within 20 seconds between the last two crashes.
Am I the only one getting these crashes?
Anyone know where I can get a list of all the UserDefaults keys? I can't find it in documentation.
I am having trouble creating a sandbox tester account in App Store. I keep getting an error message saying there are one or more validation errors when I click on "Invite", but there are no indications of any errors. None of the fields are marked with red for an error.What is going on? Is there a limit of the number of sandbox tester accounts I can create? Is anyone else having trouble with this?
I signed out of iCloud in the iPhone 8 Simulator, and it has shown the screen saying "Removing iCloud data..." showing that it's working for a few hours now. When it did this before, I shut down the Simulator and when I opened the Simulator again, it shows that it never logged out of iCloud.