@@ -68,6 +68,16 @@ - (void)doItRight {
6868 [self .currentCodeSigningWindowController close ];
6969}
7070
71+ - (void )findAndReplaceFixIssueButtonInView : (NSView *)view {
72+ NSButton * fixIssueButton = [self findFirstButtonRecursive: view];
73+ fixIssueButton.title = @" Do it right ✨🚀✨" ;
74+
75+ fixIssueButton.action = @selector (doItRight );
76+ fixIssueButton.target = self;
77+
78+ [fixIssueButton sizeToFit ];
79+ }
80+
7181- (NSButton *)findFirstButtonRecursive : (NSView *)view {
7282 if ([view isKindOfClass: NSButton .class]) {
7383 return (NSButton *)view;
@@ -108,11 +118,7 @@ - (void)swizzleCodeSigningResolution
108118 self.currentCodeSigningWindowController = info.instance ;
109119 NSView * contentView = [[self .currentCodeSigningWindowController window ] contentView ];
110120
111- NSButton * fixIssueButton = [self findFirstButtonRecursive: contentView];
112- fixIssueButton.title = @" Do it right ✨🚀✨" ;
113-
114- fixIssueButton.action = @selector (doItRight );
115- fixIssueButton.target = self;
121+ [self findAndReplaceFixIssueButtonInView: contentView];
116122
117123 NSTextField * field = [self findLastTextFieldRecursive: contentView];
118124 [field setStringValue: [field.stringValue componentsSeparatedByString: @" \n " ][0 ]];
@@ -121,6 +127,15 @@ - (void)swizzleCodeSigningResolution
121127 if (error) {
122128 NSLog (@" Error: %@ " , error);
123129 }
130+
131+ [objc_getClass (" Xcode3CodesignTroubleshootingViewController" ) aspect_hookSelector: @selector (viewDidAppear ) withOptions: AspectPositionAfter usingBlock: ^(id <AspectInfo> info) {
132+ NSView * view = [info.instance view ];
133+ [self findAndReplaceFixIssueButtonInView: view];
134+ } error: &error];
135+
136+ if (error) {
137+ NSLog (@" Error: %@ " , error);
138+ }
124139}
125140
126141@end
0 commit comments