Skip to content

Instantly share code, notes, and snippets.

@lijon
Created September 18, 2020 14:13
Show Gist options
  • Save lijon/ffc3a4864ce48be6fedf962a2e59a20b to your computer and use it in GitHub Desktop.
Save lijon/ffc3a4864ce48be6fedf962a2e59a20b to your computer and use it in GitHub Desktop.
// 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