I found specific case that makes app crash immediately after run from only xcode 15.
this workspace contains one swift app project and one objective c framework.
from objective c framework, there is an try-catch code.
from the try-catch code, If I cast exception clause as NSObject
the app crashed.
@try {
NSLog(@"print sth");
} @catch (NSObject * exception) {
// with (NSException * exception) or (NSError * exception) even (id exception) has no problem
NSLog(@"exception");
}
I found this code from my original app and I guess there is many similar cases. because when I fixed code from my project, another crash (but looks very similair) occured. only chagned _OBJC_METACLASS_$_NSObject
this part with others like _OBJC_CLASS_$_NSObject
I wonder if anyone knows any kind of options, flag, setting that can fix this crash and the reason.
(I already reports this issue to apple feedbackassistant but there is no action... so I ask here)
full code
// main app. ViewController.swift
import UIKit
import OjcFmkw // objective c framework
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
CustomOjc.testClass()
}
}
// CustomObj.h
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface CustomOjc : NSObject
+ (void)testClass;
@end
NS_ASSUME_NONNULL_END
// CustomObj.m
#import "CustomOjc.h"
@implementation CustomOjc
+ (void)testClass {
@try {
NSLog(@"print sth");
} @catch (NSObject * exception) {
NSLog(@"exception");
}
}
@end
it's 30days temporal download link of workspace.