Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fallback condition when adding a protocol to a subclass #94

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

L1ghtmann
Copy link
Member

What does this implement/fix? Explain your changes.

Does this close any currently open issues?

Appears to resolve #9

Any relevant logs, error output, etc?

N/A

Any other comments?

With the following code (a modified version of the code mentioned in the issue above):

@protocol CCSectionDelegate <NSObject>
- (void)updateStatusText:(NSString *)text;
- (void)requestControlCenterDismissal;
- (void)sectionHeightChanged;
- (void)showViewController:(UIViewController *)vc animated:(BOOL)animated completion:(void (^)(void))completion;
@end

%subclass CCSectionViewController : SpringBoard <CCSectionDelegate, UICollectionViewDelegate>
%end

Current logos: crash
This branch: no crash

Where has this been tested?

Operating System:

Linux (WSL)
iP7 -- iOS 14.3 - unc0ver

Platform:

Target Platform:

Toolchain Version:

SDK Version:

Copy link
Member

@uroboro uroboro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use the "elvis" operator, you can reduce the number of calls to objc_getProtocol():

objc_getProtocol(\"$_\") ?: \@protocol($_)

@L1ghtmann
Copy link
Member Author

If you use the "elvis" operator, you can reduce the number of calls to objc_getProtocol():

objc_getProtocol(\"$_\") ?: \@protocol($_)

Today I learned that's a thing. Thanks!

@L1ghtmann
Copy link
Member Author

It appears this exact fix has been proposed on two separate occasions and both times Dustin pointed out potential problems that would need to be addressed:

@L1ghtmann L1ghtmann marked this pull request as draft October 25, 2023 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

%subclass with protocols crashes in the constructor
2 participants