sugarcreek / communique

Communique - The open church communications iPhone app.
http://www.sugarcreek.net/iphone
GNU General Public License v2.0
49 stars 25 forks source link

Anyone having trouble with iOS 4 and NSXMLParserDelegate #3

Closed ghost closed 13 years ago

ghost commented 13 years ago

I keep getting the warning for this: class 'ParseOperation' does not implement the 'NSXMLParserDelegate' protocol

Also the video link isnt working now on mine. Anyone else having the same prob?

ckoehler commented 13 years ago

Just add right after the @interface ParseOperation : NSOperation, so it reads:

@interface ParseOperation : NSOperation {

ckoehler commented 13 years ago

Um, Github stripped that out. It should be [...] NSOperation lessthansymbol NSXMLParserDelegate greaterthansymbol {

ghost commented 13 years ago

Thanks that got it. Now how do we use MPMoviePlayerController and MPMoviePlayerViewController I guess Apple changed the API but I can't for the life of me figure out how to implement the viewcontroller into it now.

ckoehler commented 13 years ago

Are you sure podcasts don't play anymore? I think they may just play in the background. Wait around and you may hear some audio. Still not ideal and requiring a fix, but I think it does work.

ckoehler commented 13 years ago

The solution is to use a MPMoviePlayerViewController. Notice the View part. Then you can show the movie with [self presentMoviePlayerViewControllerAnimated:theMovie]; You can also release it right away I think, no need for the observer stuff, since the modal view should retain it. Haven't run into any problems doing it this way.

ghost commented 13 years ago

ah ok, I will try that. Thx a ton.

ghost commented 13 years ago

Could you explain where to put the new MP code? I am in MediaViewController.m looking at

-(void) playMovieAtURL: (NSURL*) theURL {

MPMoviePlayerController* theMovie =
[[MPMoviePlayerController alloc] initWithContentURL: theURL];

theMovie.scalingMode = MPMovieScalingModeAspectFill;
//theMovie.movieControlMode = MPMovieControlModeHidden;

// Register for the playback finished notification
[[NSNotificationCenter defaultCenter]
 addObserver: self
 selector: @selector(myMovieFinishedCallback:)
 name: MPMoviePlayerPlaybackDidFinishNotification
 object: theMovie];

// Movie playback is asynchronous, so this method returns immediately.
[theMovie play];

}

But can't seem to figure out how to change the MP so that it actually works without errors.

ckoehler commented 13 years ago

Try this:

- (IBAction)playMedia:(id)sender {
  MPMoviePlayerViewController* theMovie =
  [[MPMoviePlayerViewController alloc] initWithContentURL: [NSURL URLWithString: self.item.enclosureURLString]];

  theMovie.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
  // theMovie.movieControlMode = MPMovieControlModeHidden;
  theMovie.moviePlayer.controlStyle = MPMovieControlStyleFullscreen;

  // Movie playback is asynchronous, so this method returns immediately.
  [self presentMoviePlayerViewControllerAnimated:theMovie];
  [theMovie.moviePlayer play];
  [theMovie release];
}

This is modified code, so adjust as needed.

ghost commented 13 years ago

I am getting an error on the

[NSURL URLWithString: self.item.enclosureURLString]];

it is saying "Request for member "item" in something not a structure or union"

Is that the part you were saying would need to modified as needed? Sorry for the beginner questions.

ckoehler commented 13 years ago

Yes, it's modified :) I called it item. You should probably change:

 MPMoviePlayerViewController* theMovie =
 [[MPMoviePlayerViewController alloc] initWithContentURL: [NSURL URLWithString: self.item.enclosureURLString]];

to

 MPMoviePlayerViewController* theMovie =
 [[MPMoviePlayerViewController alloc] initWithContentURL: theURL];
ghost commented 13 years ago

ah ok, thank ya kindly.

That worked to get rid of errors but the movies still will not play when I press the "video" button inside the app running on the simulator. Any thoughts?

ghost commented 13 years ago

Bamm, nm it works all to well.

I needed to change the code in a couple different places for it to work. Thanks so much.

ghost commented 13 years ago

I'm getting a 'theURL is undeclared' error when I try to build. Any ideas? I've implemented the code suggested above in the 3 controller .m files.

ckoehler commented 13 years ago

Notice above my method is completely different than the one in communique. theURL comes from the method declaration, so as long as that's the same, you should have it.

sugarcreek commented 13 years ago

I just did a commit that includes the new 3.2 API for video playback. Merge the latest commit and it should fix the issue.