performSegueWithIdentifier는 식별자 오류가 있는 segue를 생성하지 않습니다. (performSegueWithIdentifier produce no segue with identifier error)


문제 설명

performSegueWithIdentifier는 식별자 오류가 있는 segue를 생성하지 않습니다. (performSegueWithIdentifier produce no segue with identifier error)

I am having hard time getting performSegueWithIdentifier to work. I keep getting

"Receiver (<UINavigationController: 0x1e59a9d0>) has no segue with
 identifier 'identA'"

What I did is that:

  1. Step: created a single view application and added a label ‑ "View controller A" to the view controller.
  2. Step: Dragged and dropped another View Controller and added a label ‑ "View controller B" to the new view controller.
  3. Step: Chose view controller A and performed Editor‑>embed in‑>navigation controller
  4. Step: wired View controller A to View controller B with push segue with Identifier "identA" Like this:

  5. Step: added a call to performSegueWithIdentifier onView controller A's ViewDidLoad. Like this:


‑ (void)viewDidLoad
{
    [super viewDidLoad];
    [self.navigationController performSegueWithIdentifier:@"identA" sender:self];
    // Do any additional setup after loading the view, typically from a nib.
}

What have I done wrong???


참조 솔루션

방법 1:

You are calling performSegueWithIdentifier:sender: on self.navigationController but you setup the segue on View controller A:

  

wired View controller A to View controller B with push segue with   Identifier "identA"

Try replacing:

[self.navigationController performSegueWithIdentifier:@"identA" sender:self];

with 

[self performSegueWithIdentifier:@"identA" sender:self];

방법 2:

Just another suggestion (which saved me today)...

I've written many iPad & iPhone apps before, using Master‑Detail pages, Navigation Controllers, etc, but today, I was stumped, as my simple two‑screen iPhone app in XCode 5.1 refused to let me segue from one screen to another, within a UINavigationController.

It's another of those insane XCode bugs which made no sense.  I could even create a new XCode project, and there, the same segue would work perfectly.

    [self performSegueWithIdentifier:@"segueTest" sender:nil];

Eventually, I found out the cause.

I had created a blank project in XCode, manually added a Storyboard to my project, but, I'd missed a step.

When you add a Storyboard yourself, you also need to go into your .plist file, and manually add a line telling your app the name of your main storyboard.

If you don't do this, strangely, your app will build successfully, it will run, you'll probably get your first screen to be displayed successfully... but then things (like finding segue names) will start to go wrong.

(Sigh.)

I hope this helps other XCode victims.  

I need a beer...

방법 3:

Ok. Bit of a particular situation here, but in my situation I had a UISplitViewController set up in a new project. I wanted to perform a segue in the detail view controller after pressing a cell in the master table view. So in didSelectRowAtIndexPath: of the master table I performed 

[[NSNotificationCenter defaultCenter]postNotificationName:@"userDetails"
                                                           object:nil];

and in the detail view in viewDidLoad: I added the observer and the instance method

[[NSNotificationCenter defaultCenter]addObserver:self
                                        selector:@selector(userDetailsShow)
                                            name:@"userDetails"
                                          object:nil];
‑(void)userDetailsShow{
    [self performSegueWithIdentifier:@"userDetails" sender:nil];
}

When pressing the cell in the master view it would fire the method but do nothing. It turned out the problem was this:

I had left the default segue between the master table view cell and detail navigation controller active. In this case I didn't need it, so was able to delete it. Once deleting it it worked perfectly, as it should. Hopefully I can now put this hair back in...

(by YonystefanBMike Gledhillmylogon)

참조 문서

  1. performSegueWithIdentifier produce no segue with identifier error (CC BY‑SA 3.0/4.0)

#uinavigationcontroller #segue #objective-c #iOS






관련 질문

세로에서 가로로 회전할 때 UIBarButtonItem 크기를 변경하는 방법은 무엇입니까? (how to change the UIBarButtonItem size when rotate from the portrait to landscape?)

performSegueWithIdentifier는 식별자 오류가 있는 segue를 생성하지 않습니다. (performSegueWithIdentifier produce no segue with identifier error)

UIAlertController는 leftBarButtonItem을 아래로 이동합니다. (UIAlertController moves leftBarButtonItem down)

현재 모달 보기는 탐색 스택에서 탐색 모음을 숨깁니다. (present modal view hides the navigation bar in navigation stack)

테이블 뷰 셀을 선택할 때 뷰 컨트롤러를 푸시할 수 없습니다. (Can't push my view controller when I select a table view cell)

프로그래밍 방식으로 탐색 컨트롤러의 초기 viewController 설정(레이어 SDK) (Set initial viewController in Navigation controller programmatically (Layer SDK))

UIViewController 유형의 표현식으로 UINavigationController를 초기화하는 호환되지 않는 포인터 유형 (Incompatible pointer types initializing UINavigationController with an expression of type UIViewController)

탐색 컨트롤러 도구 모음 크기 및 위치 - iOS Swift (Navigation Controller Toolbar Size & Location - iOS Swift)

Segue는 뒤로 막대 버튼에 데이터를 저장합니다. (Segue saves data on back bar button)

UINavigationController 푸시 전환 중 낮은 프레임 속도 (Low frame rate during UINavigationController push transition)

뷰 컨트롤러에서 탐색 모음의 모양 재설정 (Reset the appearance of navigation bar in a view controller)

탐색 모음 제목 보기 내에서 분할된 제어 스위치를 처리하려고 합니다. (Trying to handle segmented control switch inside of navigation bar title view)







코멘트