Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7866029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:15:58+00:00 2026-06-03T00:15:58+00:00

The following code gave a warning of Sending ‘ViewController *const __strong’ to parameter of

  • 0

The following code gave a warning of Sending 'ViewController *const __strong' to parameter of incompatible type 'id<AVAudioPlayerDelegate>' (it is the third line in the following code):

NSURL *sound0URL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"0" ofType:@"aiff"]];

audioPlayer0 = [[AVAudioPlayer alloc] initWithContentsOfURL:sound0URL error:nil];

[audioPlayer0 setDelegate: self];   // <---   this line causes the warning
[audioPlayer0 prepareToPlay];

audioPlayer0.currentTime = 0;
[audioPlayer0 play];

How can it be fixed? I have this code in the ViewController‘s instance method of viewDidLoad. There was another question similar but that was a class method: Incompatible pointer types assigning to 'id<AVAudioPlayerDelegate>' from 'Class'

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:15:59+00:00Added an answer on June 3, 2026 at 12:15 am

    Conform to the AVAudioPlayerDelegate protocol in your header file and the warning will go away. By not declaring that a class conforms to a given protocol, the compiler cannot guarantee (well, at least warn) about your failure to implement the methods required of it. The following code is a corrected version that will suppress the warning.

    @interface ViewController : UIViewController <AVAudioPlayerDelegate>
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to modify a type using the following code and it gave me
My following code gave me TypeError: Error #2007: Parameter child must be non-null runtime
I was experimenting with regexps last day and the following code gave me quite
I tried following code but it gave null reference error for second line. I
My friend gave the following code which is working awesome here http://jsfiddle.net/WVLE2/ I tried
Following code works perfect and adds 1 and 2 values to the list, but
Following code return error Can't convert String onto integer, please help subject = ['eng','Math','Sci']
Following code adds a nice sepia effect to an image but when I choose
Following code: one click event (close login box) does not fire in Firefox (webkit-browser
Following code iterates through many data-rows, calcs some score per row and then sorts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.