After moving to Xcode 14 I'm getting inconsistent behavior in my throwing functions. This call works sometimes, and other times it behaves completely differently despite all the inputs and runtime conditions being the same.
And it always worked in previous versions of Swift/Xcode 13.
The method is properly translated to a throwing method in Swift. When the ObjC code runs, Swift is indeed generating an NSError** and passsing it into the ObjC method. On inspection I can see it properly sets the NSError*. Stepping through instructions it never hits the return SecureFile statement as expected.
And yet the Swift code receives a SecureFile object that is not initialized and proceeds to crash.
If I return NULL in the error path, the error is successfully caught. Someone pointed out that it seems to be behavior like swift_error(null_result) instead of swift_error(nonnull_error)
SomeAPI.h
- (nonnull SecureFile *)getSecureFile:(nonnull NSString *)fileName
:(NSError **)error
__attribute__((swift_error(nonnull_error)));
SomeAPI.m
- (nonnull SecureFile *)getSecureFile:(nonnull NSString *)fileName
:(NSError **)error {
// Some code up here that fails
if (secureFile != NULL) {
return secureFile;
} else {
*error = [NSError errorWithDomain: MyErrorDomain
code: NotLoggedIn
userInfo:@{
NSLocalizedDescriptionKey : @"User is not logged in!"
}];
}
}
SomeClass.swift
do {
let secureFile = try someAPI.getSecureFile("test")
return secureFile.decode()
} catch {
// Some recovery code here
}
Post
Replies
Boosts
Views
Activity
AFAIK iOS still enforces a strict <1GB of file writes per 24 hour period. Exceeding this limit forces a watchdog crash.
1073.75 MB of file backed memory dirtied over 15762 seconds (68.12 KB per second average), exceeding limit of 12.43 KB per second over 86400 seconds
Our application exchanges extremely large files, and sync many small files, using a series of cryptography at rest and in flight, and we do not leverage core data or sqlite.
It's very common for us to need to write back more than 1GB in a 24 hour period and our users are hitting this and crashing. Is there no setting to circumvent 1GB limit?
Not quite sure how file sharing applications are currently getting around this.
Currently testing our app's viability for running on native Apple Silicon and we're noticing that UIApplication.userDidTakeScreenshotNotification is not being invoked when taking a screenshot.
NotificationCenter.default.addObserver(self, selector: #selector(screenshotTaken), name: UIApplication.userDidTakeScreenshotNotification, object: nil)
Is there another API I should be using, or is this feature just not possible running on a mac?