I have been trying for several months now to download my Feedback Assistant data on privacy.apple.com. Since the very first time I tried, I keep receiving emails that "because of a technical issue it wasn't possible to download your data and you'll receive a notification as soon as the problem is solved. This procedure can last up to 60 days". And some days later I receive an email "The technical problem is now solved. To get a copy of your data, initiate a new request". I already initiated a new request at least twice, and each time I get the same outcome I just described, i.e. one email tells me the problem is solved, and the next one tells me that there is a problem that will be solved within 60 days. Am I doing something wrong?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm using this code to get all apps in App Store Connect:
let jwt = ...
var request = URLRequest(url: URL(string: "https://api.appstoreconnect.apple.com/v1/apps")!)
request.setValue("Bearer \(jwt)", forHTTPHeaderField: "Authorization")
let session = URLSession(configuration: .ephemeral)
let task = session.dataTask(with: request) { data, response, error in
if let error = error {
print(error)
} else if let data = data {
print(String(data: data, encoding: .utf8))
}
}
task.resume()
But the response is an error status: 400, code: ENTITY_INVALID, title: JSON processing failed. What entity is this error referring to? And what JSON is invalid? The JWT token seems to be fine, since when using a random value I get an error 401 NOT_AUTHORIZED.
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect API
Tags:
App Store Connect API
In my UI test I'm trying to force the app's appearance (light or dark). When the system appearance is light, I can force the app to be dark with this code:
var app = XCUIApplication()
app.launchArguments += ["-AppleInterfaceStyle", "Dark"]
app.launch()
But replacing Dark with Light doesn't have any effect: if the system appearance is dark: the app remains dark. Is this not possible?
Unfortunately it seems that setting the shadow attributes on the layer directly doesn't work:
let shadowView = NSView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
shadowView.wantsLayer = true
shadowView.layer!.backgroundColor = .white
shadowView.layer!.shadowRadius = 50
shadowView.layer!.shadowColor = .black
shadowView.layer!.shadowOffset = CGSize(width: 0, height: -30)
shadowView.layer!.shadowPath = CGPath(roundedRect: shadowView.bounds, cornerWidth: 25, cornerHeight: 25, transform: nil)
Setting the NSView.shadow property instead works:
let shadowView = NSView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))let shadow = NSShadow()
shadow.shadowBlurRadius = 50
shadow.shadowColor = .black
shadow.shadowOffset = CGSize(width: 0, height: -30)
shadowView.shadow = shadow
shadowView.wantsLayer = true
shadowView.layer!.backgroundColor = .white
But NSShadow doesn't support a custom path. What's the easiest way to set a shadow with a custom path?
I created in-app purchases in ascending order of their price, but in the App Store they seem to be listed in the reverse order. I would like to sort the in-app purchases by ascending price, but cannot find a way to do so. Is there a way?
In the Mail settings one can choose one of the default sounds located at /System/Library/Sounds. Playing them is easy, e.g. with NSSound(named: "Purr")?.play(), but how can I show a localized name for those sounds as Mail does? I couldn't find any way of getting a localized name. Would I have to manually translate each one to each supported language?
The list of "main" languages that can be added in Xcode in the project's Info panel (i.e. the ones that can be added without diving into the long submenu) are basically the same that can be added in App Store Connect (except that Xcode also lists Chinese (Hong Kong) (zh-HK) and English (India) (en-IN) which don't exist in App Store Connect). But I noticed that the locale identifiers sometimes refer to different regions: e.g. Xcode has Spanish (es) and Spanish (Latin America) (es-419) while App Store Connect uses Spanish (Spain) and Spanish (Mexico) which when downloaded through the App Store Connect API have the identifiers en-ES and en-MX.
Forgive my ignorance, but does that mean that the language used in Latin America and Mexico is the same? Or should I instead select the Mexico variant in Xcode so that the locale identifiers used in the app and on the App Store match?
All the mismatching locales are (Xcode first, App Store Connect second):
ar vs. ar-SA
de vs de-DE
en vs en-US
es vs es-ES
es-419 vs es-MX
fr vs fr-FR
nl vs nl-NL
When copying a 7 GB file, the filecopy function is always about 20% slower than the cp command. I tested using my MacBook Pro 14" M1 and an external SSD connected via USB.
Mac to Mac
filecopy: 4.78s
cp: 3.40s
Mac to SSD
filecopy: 20.22s
cp: 15.93s
SSD to Mac
filecopy: 20.61s
cp: 16.64s
I use the following code:
let openPanel = NSOpenPanel()
openPanel.runModal()
let source = openPanel.urls[0]
openPanel.canChooseDirectories = true
openPanel.canChooseFiles = false
openPanel.runModal()
let destination = openPanel.urls[0].appendingPathComponent(source.lastPathComponent)
source.withUnsafeFileSystemRepresentation { sourcePath in
destination.withUnsafeFileSystemRepresentation { destinationPath in
let state = copyfile_state_alloc()
defer {
copyfile_state_free(state)
}
let date = Date()
if copyfile(sourcePath, destinationPath, state, copyfile_flags_t(COPYFILE_ALL | COPYFILE_NOFOLLOW | COPYFILE_EXCL)) != 0 {
print(NSError(domain: NSPOSIXErrorDomain, code: Int(errno)))
}
print(-date.timeIntervalSinceNow)
}
}
and the very basic cp command:
time cp /path/to/source /path/to/destination
Is there a faster way to copy files? Am I doing something wrong with filecopy?
I need to manually set the frame of a NSTextField, but it seems that when added to AVPlayerView.contentOverlayView the frame gets resized so that it hugs the text.
This doesn't happen when the text field is added to a simple NSView instead.
Is this a bug? Is there a workaround?
class ViewController: NSViewController {
override func loadView() {
view = NSView()
let text = NSTextField(frame: CGRect(x: 0, y: 0, width: 200, height: 30))
text.translatesAutoresizingMaskIntoConstraints = false
text.isEditable = false
text.backgroundColor = .red
let paragraph = NSMutableParagraphStyle()
paragraph.alignment = .center
text.attributedStringValue = NSAttributedString(string: "asdf", attributes: [.paragraphStyle: paragraph])
view.addSubview(text)
// commenting out the following 3 lines solves the issue
let playerView = AVPlayerView(frame: CGRect(x: 0, y: 0, width: 200, height: 200))
view.addSubview(playerView)
playerView.contentOverlayView!.addSubview(text)
// uncommenting the following 5 lines also solves the issue, but the wrong text field frame is briefly visible before it resizes to the correct width
// DispatchQueue.main.async {
// print(text.frame)
// text.frame.size.width = 200
// text.removeConstraints(text.constraints)
// }
}
}
Is there a way to compare a local app screenshot on my Mac with the one currently on App Store Connect without downloading the screenshot itself? The API returns fileSize and sourceFileChecksum properties (https://developer.apple.com/documentation/appstoreconnectapi/read_app_screenshot_information), but the file size of my local image is different (url.resourceValues(forKeys: [.fileSizeKey]).fileSize) and the checksum is also different from the one I provided when completing the app screenshot upload.
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect API
Tags:
App Store Connect API
NSTextField and NSParagraphStyle have a alignment: NSTextAlignment property that allows to align text to the left, center, right, or natural, which means that text for left-to-right languages is aligned left and text for right-to-left languages is aligned right. What I'm looking for is how to align text in the opposite direction of the natural direction. (Note that using the leading and trailing NSLayoutConstraints is not enough as they only aligns the text bounding box, but not the text within the bounding box.)
Is there a way to accomplish this? Or is there a built-in function that allows to determine what the natural direction of a String is, so that I can then calculate the alignment by flipping that value?
In the WebVTT video subtitle format, subtitles can be horizontal, vertical growing left, or vertical growing right. The natural text direction of NSTextView is horizontal; with setLayoutOrientation(_:) I get vertical text growing left. How can I get vertical text growing right? The documentation says that with setLayoutOrientation(_:) the text view's bounds are rotated by 90° clockwise, but manually rotating them by -90° with boundsRotation = -90 just rotates everything, including the text which should have the same orientation as before, just expanding in the opposite direction.
After typing anything in a custom text field with undo support, when opening the Edit menu, the undo item is disabled. It seems that setting translatesAutoresizingMaskIntoConstraints=false, a formatter, allowsEditingTextAttributes=true and calling invalidateIntrinsicContentSize() in textDidChange(_:) causes this behaviour.
Is this expected, or is there a workaround?
Here is the code:
class ViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate {
@IBOutlet weak var textField: NSTextField!
override func loadView() {
view = NSView(frame: CGRect(x: 0, y: 0, width: 400, height: 400))
let textField = MyTextField()
textField.frame = CGRect(x: 0, y: 0, width: 100, height: 20)
textField.translatesAutoresizingMaskIntoConstraints = false
textField.formatter = MyFormatter()
textField.allowsEditingTextAttributes = true
view.addSubview(textField)
}
}
class MyTextField: NSTextField {
override func textDidChange(_ notification: Notification) {
super.textDidChange(notification)
super.invalidateIntrinsicContentSize()
}
}
class MyFormatter: Formatter {
override func string(for obj: Any?) -> String? {
return obj as? String
}
override func getObjectValue(_ obj: AutoreleasingUnsafeMutablePointer<AnyObject?>?, for string: String, errorDescription error: AutoreleasingUnsafeMutablePointer<NSString?>?) -> Bool {
obj?.pointee = string as NSString
return true
}
}
I'm trying to implement a text field in a table view that automatically adjusts its height to fit the contained text. My current implementation adjusts its intrinsicContentSize in textDidChange(_:). Unfortunately, NSCell.cellSize(forBounds:) doesn't seem to return the correct height unless setting attributedStringValue and allowsEditingTextAttributes = true for the NSTextField.
Is this expected, or is there a workaround?
Here is the code:
class ViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate {
var asdf = "asdf fjdskalöf öf fjkldösa jfklödsa kfljsaödkfj klsdajf kldöasj flkjsdöa fkljasö flkjsa öj "
override func loadView() {
view = NSView(frame: CGRect(x: 0, y: 0, width: 400, height: 400))
let scrollView = NSScrollView()
scrollView.translatesAutoresizingMaskIntoConstraints = false
let tableView = NSTableView()
tableView.usesAutomaticRowHeights = true
tableView.addTableColumn(NSTableColumn())
tableView.dataSource = self
tableView.delegate = self
scrollView.documentView = tableView
view.addSubview(scrollView)
NSLayoutConstraint.activate([scrollView.topAnchor.constraint(equalTo: view.topAnchor), scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor), scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor), scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor)])
}
func numberOfRows(in tableView: NSTableView) -> Int {
return 1
}
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
let view = NSTableCellView()
let text = AutoSizingTextField()
text.translatesAutoresizingMaskIntoConstraints = false
text.cell?.wraps = true
// uncommenting the next 2 lines and commenting out the line after them solves the issue
// text.attributedStringValue = NSAttributedString(string: asdf, attributes: [.font: text.font!, .foregroundColor: NSColor.labelColor])
// text.allowsEditingTextAttributes = true
text.stringValue = asdf
view.addSubview(text)
NSLayoutConstraint.activate([text.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20), text.topAnchor.constraint(equalTo: view.topAnchor, constant: 20), text.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -20), text.widthAnchor.constraint(equalToConstant: 200)])
return view
}
}
class AutoSizingTextField: NSTextField {
override var intrinsicContentSize: NSSize {
var size = super.intrinsicContentSize
guard let cell = cell else {
return size
}
var frame = frame
frame.size.height = .infinity
size.height = cell.cellSize(forBounds: frame).height
NSLog("intrinsicContentSize \(size)")
return size
}
override func textDidChange(_ notification: Notification) {
super.textDidChange(notification)
invalidateIntrinsicContentSize()
needsLayout = true
layoutSubtreeIfNeeded()
}
override func layout() {
invalidateIntrinsicContentSize()
super.layout()
}
}
I see that one can get all app categories, but I don't see a way of getting all supported screenshot display types and app preview types. Is this possible and if not, is there some way of getting all supported types without having to download the API specification?
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect API
Tags:
App Store Connect API