is forKey:fileSize considered accessing non-public API?

is forKey:fileSize considered accessing non-public API?

has your app been rejected at review stage due to this?

let resources = PHAssetResource.assetResources(for: asset)
if let resource = resources.first {
    if let fileSize = resource.value(forKey: "fileSize") as? Int {
        return fileSize
    }
}

is forKey:fileSize considered accessing non-public API?

value(forKey:) itself is public API of course, so you likely wouldn’t get rejected by whatever means App Review uses to try to flag more obvious non-public API usage.

However, you are relying on undefined behavior, which is still a bad idea for compatibility. The documentation of that class doesn’t mention a property by that name being supported via KVC.

In fact, at this very moment, an engineer at Apple may be busy rewriting PHAssetResource in a way that still conforms to the documented API but no longer responds to fetching that particular property via KVC, and your code would stop working in the next OS release. Make sure your app can handle that.

is forKey:fileSize considered accessing non-public API?
 
 
Q