I6C
I6C

Reputation: 27

iPhone App to listen radio

I'd like to create an iPhone App that allows people to listen to radio. Below is what I've done so far, but when I click on the button nothing happen, can someone please advise what I've done wrong here.

Thanks in advance.

#import <UIKit/UIKit.h>

@interface RadioViewController : UIViewController{

IBOutlet UIWebView *webView;
}

-(IBAction)radio;
@property(nonatomic,retain)UIWebView *webview;

@end


#import "RadioViewController.h"
#import <MediaPlayer/MediaPlayer.h>
@implementation RadioViewController

@synthesize webview;

-(IBAction)radio{

    NSURL *url = [NSURL URLWithString:@"http://db5195728.tis.core.005.cdn.streamfarm.net:80/3212_erf_96_live.mp3"];
    NSURLRequest *req = [NSURLRequest requestWithURL: url];
    [webview loadRequest:req];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

Upvotes: 1

Views: 439

Answers (1)

sunkehappy
sunkehappy

Reputation: 9091

I've tried your code. It works fine here. So:

  1. Make sure your radio is called when you tap that button. You can set a break point there or add a NSLog to see whether it is called;
  2. Make sure your webview is correctly add to your view:shown and of the correct size.

Upvotes: 1

Related Questions