I've written a little utility targeting Mac, for personal use. In it, I need to be able to select a file from an arbitrary location on my drive.
I have the "user selected file" entitlement added, and I have added my application to "Full Disk Access." But I still get a permissions error when I select a file with the file-open dialog (via .fileImporter).
I dragged the application from the Xcode build directory to Applications before adding it to Full Disk Access. Any ideas?
Post
Replies
Boosts
Views
Activity
I'm trying (in Swift) to use CryptoKit to generate the required JWT for the Apple Music Web API, as documented (sort of) here.
But I'm getting 401s no matter what I try. I found some examples of generating JWTs online, but something isn't working here. I've set up my identifiers and gotten an API secret through my account in the dev portal. It's associated with an identifier requesting Music API access (I requested all three available Music-related capabilities).
For the secret, I'm using the long key string from the .p8 file I generated and downloaded from the dev portal.
Here's what I've tried:
struct APIToken
{
struct Header: Encodable
{
let alg = "HS256"
let kid: String
}
struct Payload: Encodable
{
let iss: String
let iat: String
let exp: String
}
static func tokenize(keyID: String, issuerID: String, secret: String) -> String
{
let privateKey = SymmetricKey(data: Data(secret.utf8))
let headerJSONData = try! JSONEncoder().encode(Header(kid: keyID))
let headerBase64String = headerJSONData.base64EncodedString()
let currUnixTime = Int(Date().timeIntervalSince1970)
let expUnixTime = currUnixTime + 5 * 2628288 // five months of seconds
let payloadJSONData = try! JSONEncoder().encode(Payload(iss: issuerID, iat: "\(currUnixTime)", exp: "\(expUnixTime)"))
let payloadBase64String = payloadJSONData.base64EncodedString()
let toSign = Data((headerBase64String + "." + payloadBase64String).utf8)
let signature = HMAC<SHA256>.authenticationCode(for: toSign, using: privateKey)
let signatureBase64String = Data(signature).base64EncodedString()
let token = [headerBase64String, payloadBase64String, signatureBase64String].joined(separator: ".")
print(token)
return token
}
}
I also tried making sure the base64 strings are URL-safe with this extension:
extension Data
{
func URLSafeBase64EncodedString() -> String
{
return base64EncodedString()
.replacingOccurrences(of: "+", with: "-")
.replacingOccurrences(of: "/", with: "_")
.replacingOccurrences(of: "=", with: "")
}
}
but that made no difference.
All the documentation says is
A decoded developer token has the following format.
{
"alg": "ES256",
"kid": "ABC123DEFG"
}
{
"iss": "DEF123GHIJ",
"iat": 1437179036,
"exp": 1493298100
}
After you create the token, sign it with your MusicKit private key using the ES256 algorithm.
Am I not doing that? Any insight appreciated.
Something (or a lot) is janky about apps built for "My Mac - designed for iPad."
Aside from things just not working, the amount of garbage spewed to the console during debugging is unmanageable. I can't see my own trace statements amongst screens and screens of repetitive nonsense.
I right-clicked on it and set it to filter out errors, but I'd like to get notified of legitimate errors. Anyone employing a clever filtering method I'm not aware of?
I can't find any way to search for a song by title only. You can search for songs, but any term you provide appears to be applied to any metadata associated with the song. Look at the largely nonsensical results when I search for a song with the letters "de":
In many cases, that string doesn't appear anywhere. I used
MusicCatalogSearchRequest(term: searchTerm, types: [Song.self])
Likewise it stands to reason that people want to search for artist and album names using text strings. How do we do that?
I don't see any certificates or CAs in the Passwords application, so now what?
My application suddenly started crashing on launch when I target "My Mac - designed for iPad." But only after the first build from scratch, which runs once. All subsequent runs crash with:
dyld[90869]: Symbol not found: _OBJC_CLASS_$_AVPlayerView
Referenced from: <D566512D-CAB4-3EA6-9B87-DBD15C6E71B3> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Debugger/libViewDebuggerSupport.dylib
Expected in: <4C34313C-03AD-32EB-8722-8A77C64AB959> /System/iOSSupport/System/Library/Frameworks/AVKit.framework/Versions/A/AVKit
I don't use AVPlayerView anywhere in my application. A file-contents search of the entire source tree doesn't turn it up either. The application doesn't even get to the point of instantiating the app object, so none of my code is involved.
If I switch the target to my iPhone, it will build and run repeatedly. If I then switch back to "My Mac," it will build and run once... and then crash every time.
Further research shows that this only happens in Debug builds.
This is a major issue right now because iOS 18 broke authentication certificates (thus HTTPS), so anyone writing or debugging an app that needs network functionality must use HTTP on localhost. In my case, I'm dead in the water because I can't debug on my local machine.
Has anyone seen something like this before? I can find no reference to anything like it.
Hi all. I renewed my membership, got a confirmation E-mail, and followed the link in it to check the status. It says "enrollment complete." But if I log into the developer portal, it says "membership expired."
There is no chat option for support, only a form for E-mail. The response time quoted is up to two days. Meanwhile, I can't implement some critical features in an app I'm building, because they require an active developer account.
Not cool, Apple. Anybody else experience this?
I have a project that has been building fine up until recently, when I started seeing spurious errors flagged in the editor on lines that were correct... and when the build was reported as successful and the app ran. The lines were often flagged twice for the same "error," and selecting the suggested "fix" produced syntactically incorrect lines because Xcode replaced the wrong characters.
Now the builds are actually failing, on correct lines and preprocessing failures (allegedly missing header files that have never been missing before, with no project changes).
Also there's a lot of
Could not read serialized diagnostics file: error("Invalid diagnostics signature")
reported in the build output, although that's categorized as a warning.
Cleaning and deleting DerivedData has no effect. I'm not using CocoaPods or Swift packages, which you see cited in a lot of reports about this.
Has anyone found a workaround?