Created
September 18, 2020 14:13
-
-
Save lijon/ffc3a4864ce48be6fedf962a2e59a20b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// if AudioComponentCopyIcon() returns nil, call this method and try again! | |
- (void)componentIconHack { | |
AudioComponentDescription searchDesc = { 0,}; | |
AudioComponent comp = NULL; | |
while(true) { | |
comp = AudioComponentFindNext(comp, &searchDesc); | |
if(!comp) | |
break; | |
UIImage *img; | |
if (@available(iOS 14.0, *)) { | |
img = AudioComponentCopyIcon(comp); | |
} else { | |
img = AudioComponentGetIcon(comp, 256); | |
} | |
if(img) { | |
NSLog(@"--- componentIconHack: got icon: %@",img); | |
return; | |
} | |
} | |
NSLog(@"--- componentIconHack: Could not find any AudioComponent with an icon!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment