Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to simple update some text on an app created at my firm before my time. The app is a native iOS app and I'm not familiar with objective C so I'm not sure how to search for these solutions.

I have the following code:

- (IBAction)PlayFirstVideo:(id)sender {
// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];

// set the blocks 
reach.reachableBlock = ^(Reachability*reach)
{
    dispatch_async(dispatch_get_main_queue(), ^{
    NSString *url = @"http://domainname.com/tvxcode/tomatobasilsequence/tomatobasil_all.m3u8";
    videoPlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:url]];
    [self.view addSubview:videoPlayer.view];
    videoPlayer.view.frame = CGRectMake(359, 0, 665, 375);  
    [videoPlayer play];
        });
};

reach.unreachableBlock = ^(Reachability*reach)
{
    dispatch_async(dispatch_get_main_queue(), ^{
    UIAlertView *noConnection = [[UIAlertView alloc] initWithTitle:@"Connection Required"
             message:@"An internet connection is required to view videos."
             delegate:nil
             cancelButtonTitle:@"OK"
             otherButtonTitles:nil];
    [noConnection show];
        });
};

// start the notifier which will cause the reachability object to retain itself!
[reach startNotifier];
}

This generates three errors:

  • No known class method for selector 'reachabilityWithHostname:'
  • Property 'reachableBlock' not found on object of type 'Reachability *'
  • Property 'unreachableBlock' not found on object of type 'Reachability *'

My real question is obviously how to fix this, however I'm not even sure if those are custom classes or not. They don't seem to match the previous developer's name styles and habits so if that's the case is this a problem because I updated xCode?

share|improve this question
add comment

2 Answers

The Reachability class is from an Apple sample project.

http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

Most likely explanation for your errors is that you don't have a #import for "Reachability.h" at the top of that file. You've probably only got a forward declaration for it.

share|improve this answer
    
Hmm, I do have #import "Reachability.h" at the top of the document. Any other ideas? –  thatgibbyguy May 21 '13 at 19:58
    
I face the same problem! –  Ravindranath Akila Oct 17 '13 at 7:16
add comment

There is a separate reachability project at https://github.com/tonymillion/Reachability, which appears to be what you are using, and is different than the apple version. The two probably conflict.

Other projects such as sharekit include reachability.h and .m files. You might check to see if there is a conflicting version somewhere in your includes, and the differences between the definitions.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.