Post

Replies

Boosts

Views

Activity

Reply to Am I allowed to use a custom Apple Pay button design for my iOS app?
Effectively doc is not really clear. What I understand is that you can have your button to launch payment. This must not say Apple Pay. If the user has selected Apple Pay as the default payment, then it will proceed. But if you have him to select Apple Pay, you have to use the official button. However, you should check twice if you cannot accurate with the existing designs, to avoid any risk during review process.
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’21
Reply to FileManager contentsOfDirectory fails with error 256
I tested the following (Xcode 12.4): do { let content = try FileManager.default.contentsOfDirectory(atPath: "/Users/me") print("content", content) } catch { print("error", error) } do { let content = try FileManager.default.contentsOfDirectory(at: URL.init(fileURLWithPath:"/Users/me"), includingPropertiesForKeys: nil) print("content", content) } catch { print("error", error) } do { let content = try FileManager.default.contentsOfDirectory(at: URL.init(fileURLWithPath:"/Users/me"), includingPropertiesForKeys: nil, options: [.skipsHiddenFiles]) print("content", content) } catch { print("error", error) } It does provide in all cases the complete directory (including hidden files except in last case). But does not work in playground.
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’21
Reply to macOS sandbox problem with auxiliary binaries
On your 2nd question, it would be logical that you cannot make it "programmatically", but only through dialog. The trick I use to solve (partially) the problem is to first ask an authorisation to access the folder itself, then all files created there are accessible. But that will not work after users move their files… In one word, sandboxing is a real headache (at least for me).
Topic: Code Signing SubTopic: Entitlements Tags:
Apr ’21
Reply to swift
Please, when you post code, edit it properly with the formatter tool (). And provide enough code to let other understand what's going on. And don't hide the problem as a comment in code. import UIKit import Foundation enum gameType { case easy case medium case hard case player2 } class MenuVc : UIViewController { @IBAction func Player2( sender: Any) { moveToGame(game: .player2) } @IBAction func Easy( sender: Any) { moveToGame(game: .easy) } @IBAction func Medium( sender: Any) { moveToGame(game: .medium) } @IBAction func Hard( sender: Any) { moveToGame(game: .hard) } func moveToGame(game : gameType ) { let gameVc = self.storyboard?.instantiateViewController(withIdentifier: "gameVc") as! GameViewController currentGameType = game // error here Cannot assign value of type 'gameType' to type 'gameType.Type'. self.navigationController?.pushViewController(gameVc, animated: true) } } Some comments: enum should start with Uppercase: enum GameType func and var names would start with lowercase if you know the type of argument (as UIButton), use it instead of Any take care to use the exact signature (including underscore) @IBAction func easy(_ sender: UIButton) { can anyone explain what wrong in the code currentGameType = game // error here Cannot assign value of type 'gameType' to type 'gameType.Type'. How did you define currentGameType ? I do not see it declared anywhere in code. It should be gameType If you have defined var currentGameType = gameType.self (why ?) then you get the error message. But using a code written with Xcode 3 in Xcode 10 will lead to a lot of such problem. Don't try it you will loose your time. If that answers your problem, please don't forget to close the thread on the correct answer. Otherwise, please explain and provide required code.
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’21
Reply to Xcode 12.4: Image Literal returns error message
You didn't tell what diceImageView1 is, but I understand it is an UIImageView. Right ? If so, you should write: diceImageView1.image = then type image lit and auto completion will propose to choose "DiceSix" To choose image, you can open library / Media, from the View Menu in Xcode. May be you need ? optional chaining, depending on the definition of diceImageView1 This will explain more: https://stackoverflow.com/questions/51397347/xcode-10-image-literals-no-longer-available
Apr ’21
Reply to Preferencepane version instead of systempreferences version
It's not clear what you are looking for. Is it iOS or MacOS ? Im trying to get the version of my preferencepane that i built in swift key for the actual pane bundleverion What do you get ? What did you expect ? Is it the build number ? Then, call         let build = Bundle.main.infoDictionary!["CFBundleVersion"] as! String Could you show the complete code for your preference Pane ? Note: the build version is probably only useful from inside the app. If so, did you see this notice: https://developer.apple.com/documentation/preferencepanes Note Use preference pane bundles only for settings that must be managed separately from your app. For example, use it to manage settings that are shared between multiple apps in the same suite. Manage app-specific preferences using a custom preferences interface.
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’21