Reputation: 31
I'm developing a Flutter application and encountering an issue with nullability specifiers in Xcode. Specifically, I have methods in my Objective-C files where Xcode is reporting conflicts with existing specifiers like 'nullable' and 'nonnull'.
Here's an example of the code causing the issue:
- (instancetype)init {
return [self initWithPresentingViewController:nil];
}
- (instancetype)initWithPresentingViewController:(UIViewController *)presentingViewController {
NSAssert(presentingViewController != nil, @"presentingViewController cannot be nil on iOS 13");
self = [super init];
if (self) {
_presentingViewController = presentingViewController;
}
return self;
}
- (instancetype)initWithPresentingViewController:(UIViewController *)presentingViewController
prefersEphemeralSession:(BOOL)prefersEphemeralSession {
NSAssert(presentingViewController != nil, @"presentingViewController cannot be nil on iOS 13");
self = [super init];
if (self) {
_presentingViewController = presentingViewController;
_prefersEphemeralSession = prefersEphemeralSession;
}
return self;
}
Xcode highlights these lines and shows errors like:
Nullability specifier 'nonnull' conflicts with existing specifier 'nullable'.
and Flutter Terminal:
Nullability Issue (Xcode): Nullability specifier 'null_unspecified' conflicts
with existing specifier 'nullable'
Could not build the application for the simulator.
Error launching application on iPhone 14.
I've tried correcting the nullability specifiers, but the error persists. How can I resolve this issue?
Additional Information:
Developing a Flutter application.
Running into nullability specifier conflicts specifically in Objective-C files.
Upvotes: 0
Views: 55