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

  • Home
  • SEARCH
  • 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 8170123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:04:19+00:00 2026-06-06T21:04:19+00:00

The thing I want to do is: First, the TopPlacesViewController has a segue to

  • 0

The thing I want to do is:

First, the TopPlacesViewController has a segue to the class SinglePlacePhotosViewController (a TableView controller).

I create a delegate in the TopPlacesViewController class, then use the prepareforSegue method to set the SinglePlacePhotosViewController as the delegate and implement the protocol method.

Then when I click a photo in the TopPlacesViewController (TableView controller), it calls the method TopPlacesViewController which should show some photos from that place.

But I kept getting this error:

[SinglePlacePhotosViewController setDelegate:]: unrecognized selector sent to instance 0xc94cc20

My TopPlacesViewController.h file:

@class TopPlacesViewController;  

@protocol TopPlacesViewControllerDelegate    
- (void)topPlacesViewControllerDelegate:(TopPlacesViewController *)sender
                            showPhotos:(NSArray *)photo;   
@end

@interface TopPlacesViewController : UITableViewController

@property (nonatomic,weak) id <TopPlacesViewControllerDelegate> delegate;   
@end   

TopPlacesViewController.m:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{                                                                                  
    NSDictionary *place = [self.places objectAtIndex:indexPath.row];   
    self.singlePlacePhotos = [FlickrFetcher photosInPlace:place maxResults:50];   
    [self.delegate topPlacesViewControllerDelegate:self showPhotos:self.singlePlacePhotos];  
    [self performSegueWithIdentifier:@"Flickr Photos" sender:self];   
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{   
    if([segue.identifier isEqualToString:@"Flickr Photos"]) {                                  
          [segue.destinationViewController setDelegate:self];     
    }         
}  

Then in this I implement the delegate:

@interface SinglePlacePhotosViewController () <"TopPlacesViewControllerDelegate">    
- (void)topPlacesViewControllerDelegate:(TopPlacesViewController *)sender showPhoto:(NSArray *)photo    
{    
    self.photos = photo;    
}
  • 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-06T21:04:20+00:00Added an answer on June 6, 2026 at 9:04 pm

    Yes exactly the error is obvious because you are calling the setter method (setDelegate:) of SinglePlacePhotosviewController but the @property (nonatomic,weak) id delegate; is in TopPlacesViewController.

    you are using protocol here in wrong way.
    if u want pass the array of photos from TopPlacesViewController to SinglePlacePhotosviewController,
    simply assign the array from TopPlacesViewController to the array of SinglePlacePhotosviewController in prepareSegue method.

    Protocols generally used for passing the reference of one class to another class, here u already have the instance of SinglePlacePhotosviewController (segue.destinationController) in TopPlacesViewController. If u want the reference of TopPlacesViewController in SinglePlacePhotosviewController then u have to make protocol in SinglePlacePhotosviewController and pass the self of TopPlacesViewController to the delegate protocol of SinglePlacePhotosviewController in prepare segue method as u r doing here.
    hope i have cleared your query, please let me know.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use Google Analytics, and the first thing I want to check every day
First thing i want to say that it's not an easy question to explain,
Say that a page loads and the first thing I want to do is
I'm wondering about one thing : I want to ask the user while first
So I have a table. First thing I want to do is put some
I'm toying around with OCaml. The first thing I want to know how to
first thing I want to know in between two algorithms which one is better
OK, first thing I want to say is: yes, I know there are a
First of all I want to mention two things, One: My code isn't perfect
The thing I want to know here should be really 'basic', but it is

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.