0

I have a class within my AppDelegate.m file called PAEAudioHost which I am using to play audio, and I want to stop the audio file using a UIButton in my Detail:Controller.m file.

To stop and start the audio file you use the public member functions:

void (start) void (stop) 

I have tried the following code in the detail controller:

 P11AppDelegate* app =[[UIApplication sharedApplication] delegate]; [app.host stop] 

This produces an error stating: "Property 'host' not found on object of type 'DetailController *'"

Any ideas how I can achieve this?

0

1 Answer 1

1

host (PAEAudioHost) is a public property insite your AppDelegate? So:

P11AppDelegate* app = [[UIApplication sharedApplication] delegate]; [app.host stop] 

EDIT:

You should have a public property called host into AppDelegate.h:

@interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) PAEAudioHost *host; 
Sign up to request clarification or add additional context in comments.

3 Comments

It needs to be cast: P11AppDelegate* app = (P11AppDelegate*) [[UIApplication sharedApplication] delegate];
This answer produced a couple of errors. The first states: "property with 'retain or (strong)' attribute must be of object type" and the second states: "unknown type name 'PAEAudioHost'
You said: I have a class within my AppDelegate.m file called PAEAudioHost. You explained it wrong. Show all your and we can help you.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.