Post

Replies

Boosts

Views

Activity

Class with properties of custom types into UserDefaults
Hi, I am making an iOS video game and want to save the player's data. Is it possible to save an instance of this class into UserDefaults? The class in question has properties that reference other custom classes. This is my class definition: class Warrior: CombatEligible {   var name: String = ""   var gender: String = ""   var level: Int = 1   var xp: Int = 0   var current_dimension: VirtualDimension = Master_Nexus   var gold: Int = 0   var weapons: [String] = []   var completed_dimensions: [VirtualDimension] = []   var hp: Int = 10   var items: [Item] = []   var knocked_out: Bool = false   var pet: Monster = myPet   var warrior_created = false   var defeated_monsters: Int = 0   var currentTarget: Monster = no_monster   var maxWeight: Int = 0   var defeated_bosses: Int = 0   var inCombat: Bool = checkCombat()   var targetIsInvisible: Bool = false   var inBossBattle: MultipleValues = [false, no_boss]   var invisible: Bool = false   var hypnotized: Bool = false   var switchingEnabled: Bool = true   var switchedToPet: Bool = false   var stunned: Bool = false   var errodable_target_weakened: Bool = false   var errodable_target_weakened_target: Monster = no_monster   var currentWeapon: Weapon? } The class has properties that are instances of other classes for example: var pet: Monster = myPet (myPet is an instance of the Monster class). Therefore, Warrior cannot conform to the Codable protocol and cannot be saved to UserDefaults. What do I do?
3
0
289
Feb ’22
Progress bar issues
Hi, I am developing a MacOS app for the Mac App Store using AppleScript. It was rejected because the Stop button of one of the progress bars did not produce any action when clicked (or, at least it didn't for over 5 minutes). I have a theory for why this happened: The app was in the middle of executing a shell command while the progress bar was showing, so the application was unresponsive and thus not responsive to user clicks. But this doesn't help me solve the issue. If the app is not responsive at that time, how do I make the app close when the "Stop" button is clicked? I want the whole app to close quickly when Stop is pressed. Another thing that further complicates this issue is that everything is wrapped in try-catch blocks. When a user cancels something in AppleScript (such as by pressing a Stop button in a progress bar), an error is thrown to signal that the script must stop. If the user clicks "Stop" in the middle of a try-catch block, the script will not cancel-it will execute whatever I tell it to do on an error. There are too many try blocks in the app to put in a check for what error occurred in each one. So, how do I make the script respond quickly and produce the desired action (closing the app) in under 5 minutes?
6
0
1.6k
May ’21
App rejected for strange reason
Hi, I'm building a network troubleshooting app for the Mac App Store (so it's a Mac app). I am using wget. Since I can't call the wget tool normally (because of App Sandboxing) in /usr/local/bin, I tried bundling wget inside of my app (in Contents/MacOS) and code signed it. Wget was also sandboxed itself, and it works okay that way. However, when I uploaded my build to the App Store, I submitted the app for review. But it was rejected. This is the rejection letter, which I don't understand: " Guideline 2.5.1 - Performance Your app links against the following non-public framework(s): • Contents/MacOS/wget/_SSL_CTX_set_options Next Steps The use of non-public APIs is not permitted on the App Store as it can lead to a poor user experience should these APIs change. If you are unable to reproduce this issue, ensure you are testing the exact version of the app that you submitted for review, and that you're doing so in a minimally privileged environment. See Technical Q&A QA1778: How to reproduce bugs reported against Mac App Store submissions. For additional information on crash reports, see Diagnosing Issues Using Crash Reports and Device Logs." I do not know what to do. How can I use wget and get my app approved? I also don’t know how to reproduce a bug like that without wget’s source code. I also do not fully understand this rejection. What is “_SSL_CTX_set_options,” and why is my app being rejected for using it? I don’t use that framework directly, and “Contents/MacOS/wget” is even mentioned in the letter, so that must be it. But what do I do? What I’m asking is either: Option A: Is there a way to use wget without bundling it in my app (so the app is accepted), even from a sandbox that blocks access to /usr/local/bin and wget (with no temporary exceptions)? Or Option B: Is there a way to troubleshoot this, so I can stop wget from using this framework (while still keeping it’s functionality), or stop Apple from rejecting it for this reason (maybe with an entitlement that allows this framework, or even a temporary exception?)? I think Option A would be a lot easier, but if you can’t think of a solution maybe you can look at Option B? I really need to use wget, and need your help!
0
0
534
May ’21
I can't submit my app to the app store
Hi! I am trying to submit my MacOS app to the Mac App Store. I have paid for an Apple Developer Account and filled out all the necessary information in App Store Connect. I do not have any Xcode project, or anything else built in Xcode. I built the app using Script Editor. The main application and one out of two helper programs are all written in AppleScript. The other helper program is an automator applet. This is a full-fledged and complex app, even though it uses languages that normally make small, quick automation scripts. Note: The helpers are .app files inside of the package contents of the main .app bundle. My app never accesses anything outside of it's own package contents except for command-line tools (ping, wget, curl, networksetup, and defaults). I have filled out all the information in App Store Connect, but have not been able to upload my build. I have a pkg installer archive that is signed with the certificate "3rd Party Mac Developer Installer: [My name] (T36UWKSKUU)" right from my paid Apple Developer Account from developer.apple.com. The pkg is thus fully signe with an apple-issued certificate. My .app bundle was also signed with a certificate from my Developer Account, called "3rd Party Mac Developer Application: [My name] (T36UWKSKUU)". I have used xattr -cr to remove extended attributes before I codesign the app bundle. I am having errors submitting my app to the Mac App Store. I would like you to help me fix these errors so I can upload my build to the App Store. These are the errors thrown by different upload tools when I try to upload my build (note: I do have Xcode installed, so I can use xcrun altool): Xcode: I cannot use Xcode to submit because there is no Xcode project. The app was not made using Xcode. Application Loader: That seems to be gone in the latest release of Xcode, which I am running. Transporter: When I upload my pkg in Transporter after signing in correctly, I get the following error message: "Could not create a temporary .itmsp package for the app “Network Troubleshooter.pkg”. Failed to get the app‘s bundle id." CFBundleIdentifier, CFBundleVersion, and CFBundleVersionShortString are all set in my app's Info.plist, so I don't understand this error. xcrun altool: When I run the following: xcrun altool --upload-app -f /Applications/Network\ Troubleshooter.pkg -t osx -u [my apple id username] -p [my app-specific password from appleid.apple.com], I get the following error message: 2021-04-14 16:31:34.382 altool[2245:31985] CFURLRequestSetHTTPCookieStorageAcceptPolicy_block_invoke: no longer implemented and should not be called 2021-04-14 16:31:37.093 altool[2245:31977] * Error: Error uploading '/Applications/Network Troubleshooter.pkg'. 2021-04-14 16:31:37.102 altool[2245:31977] * Error: code -20008 (Unable to validate your application. The Info.plist indicates a Mac app, but submitting an ipa.) I am not submitting an ipa, but a pkg, and my app IS a Mac app. I have used zero API's or libraries anywhere in my code. Yes, it's strange, but that's the truth. Another thing is that if I temporarily move my .app file out of /Applications and run my pkg, it says the installation was sucessful. But no new files are added/installed in /Applications. I signed the pkg with productsign and built it with productbuild. Also, my actual .app bundle that is made into a pkg has a different filename than the pkg and the name on App Store Connect. App Store Connect app name: Network Troubleshooter Pkg name: Network Troubleshooter.pkg .app file name: Network Troubleshooting Assistant.app Network Troubleshooting Assistant is too long to be entered in App Store connect, so I used Network Troubleshooter instead. So, can you please help me fix these errors so I can upload my build and submit my app to the Mac App Store? I would really appreciate it. Thanks in advance for your help!
4
0
1.4k
Apr ’21