-
Notifications
You must be signed in to change notification settings - Fork 439
Fix iOS example #953
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
Fix iOS example #953
Conversation
@NightBlaze thanks for the fix! Could you let me know if you agree with that Copilot review? |
@NightBlaze thanks for updating and resuscitating this PR 😄 As I said, I'm no iOS developer and so like to depend on Copilot for a review and then see if it makes sense. It's offering some more comments after your latest update. If you would look into those? Thanks for getting this right 💪 |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@roderickvd Yes, I agree with the comments. I haven't written in Objective-C for a while, so I've forgotten some of the details :) I've updated the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an iOS crash on startup by properly activating the audio session after setting its category. The fix adds explicit audio session activation with proper error handling to prevent crashes when the app starts with an inactive audio session.
Key Changes
- Add audio session activation after setting the category
- Improve error handling with separate error variables for category and activation operations
- Update error logging to provide more specific error information
Comments suppressed due to low confidence (2)
examples/ios-feedback/ios-src/AppDelegate.m:33
- [nitpick] The variable name 'isSetCategorySuccess' is verbose and inconsistent with iOS naming conventions. Consider using 'categorySuccess' or 'setCategorySuccess' to follow typical Objective-C naming patterns.
BOOL isSetCategorySuccess = [session setCategory:AVAudioSessionCategoryPlayAndRecord
examples/ios-feedback/ios-src/AppDelegate.m:38
- [nitpick] The variable name 'isActivateSuccess' is verbose and inconsistent with iOS naming conventions. Consider using 'activateSuccess' or 'setActiveSuccess' to follow typical Objective-C naming patterns.
BOOL isActivateSuccess = [session setActive:YES error:&activateError];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks. If you could top it off with a changelog entry? Good to merge after.
Copilot came up with two final nitpicks regarding variable naming, if you want to take those into account, at your option.
Updated the changelog. This time I don't agree with Copilot because Objective-C is very verbose and by convention bool flags should start from Thanks for guided me through the PR! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for doing the iterations and getting the example exactly right. Very valuable for users.
Fix iOS crash on startup due to inactive audio session