• Register
0 votes
643 views

Problem :

I am trying to present the view controller as the pop over if the user successfully resets their password. Basically, if all is ok with emailing the password reset instruction email then the below code will run. But I am facing below error

Implicit user of 'self' in closure; use '.self' to make capture semantics explicit

On the very first line as shown below:

let MYVC = storyboard?.instantiateViewControllerWithIdentifier("ResetPasswordSuccessPopOver") as! ResetPasswordSuccessPopOverViewController

MYVC.preferredContentSize = CGSize(width: UIScreen.mainScreen().bounds.width, height: 100)

let mynavController = UINavigationController(rootViewController: MYVC)

mynavController.modalPresentationStyle = UIModalPresentationStyle.Popover

let mypopover = mynavController.popoverPresentationController

popover?.delegate = self

self.presentViewController(mynavController, animated: true, completion: nil)

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I have read your problem. I have understood your problem completely as I had also faced similar problem in recent past. I had done research on it and found out solution on it.

To resolve your problem please try below solutions :

let myviewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("ResetPasswordSuccessPopOver") as ResetPasswordSuccessPopOverViewController

OR

 let myviewController = self.storyboard!.instantiateViewControllerWithIdentifier("ResetPasswordSuccessPopOver") as ResetPasswordSuccessPopOverViewController

OR

In Swift the semantics of the self reference being captured are not allowed to be explicit, So  referring to any member of the object inside the closure requires you to show the full commitment to the capturing with self. being explicitly added to the referenced identifiers.

let MYVC = self.storyboard?.instantiateViewControllerWithIdentifier("ResetPasswordSuccessPopOver") as! ResetPasswordSuccessPopOverViewController

Please Note self. before storyboard?..

9 7 4
38,600 points

Related questions

0 votes
1 answer 828 views
828 views
Problem : Facing following Swift issue must register a nib or a class for the identifier or connect a prototype cell in a storyboard
asked Nov 15, 2019 peterlaw 6.9k points
0 votes
1 answer 3 views
3 views
Problem: I have a simple object which conforms to the NSCoding protocol. Any idea what's causing this? "[User defaults] attempt to set a non-property-list object."
asked 3 days ago anika11 4.1k points
0 votes
1 answer 2 views
2 views
Problem: Parse for iOS - Undefined symbols for architecture i386 iPhone 5.I am getting few similar Undefined symbols for architecture i386: ... "_OBJC_CLASS_$_PFAnalytics", referenced from: errors while building for iPhone 4s simulator or iPhone 5 simulator.With iPhone 5s-> everything works great. What am I doing wrong?
asked 4 days ago sumaiya simi 15.8k points
0 votes
1 answer 2 views
2 views
Problem: With or without @IBAction in the unwind method, I get the same issue described in the referenced problem - dragging a line from my UIButton to the Exit button in Storyboard IB, does not show any action to connect with. Please help me?
asked 4 days ago Sana8989 8.9k points
0 votes
1 answer 1 view
1 view
Problem,: please help to solve this wquestion... creating an image format with an unknown type is an error swift 3
asked Apr 1 Ifra 24.4k points
1 vote
1 answer 9 views
9 views
Problem : When upgraded to Xcode 6.3 Beta 3 and a lot of error(s) are appearing relating to the following: Initializer does not override a designated initializer from its superclass. Can someone please help fix this, I am new in IOS Swift .
asked Mar 20 Shovo210 14k points
0 votes
1 answer 42 views
42 views
Problem : I am new in swift and I got this error while click the only equal button but The code works normally. Anyone tell me What does this mean? Error “Thread 1:EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)”
asked Mar 2 Shovo210 14k points
0 votes
1 answer 465 views
465 views
Problem: I am trying to archive my project but facing very unexpected error as shown below: Showing Recent Messages:-1: mkdir -p /Users/spritzindia/Library/Developer/Xcode/DerivedData/Contigo-atftiouzrdopcmcpprphpilawwzm/Build/Products/Debug-iphonesimulator/Contigo.app/Frameworks Showing ... : pod 'IQKeyboardManagerSwift'  pod 'SDWebImage', '~> 4.0'  pod 'KRPullLoader'  pod 'Paytm-Payments'
asked Aug 25, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 744 views
744 views
Problem : I am very new to Swift. Now I have started learning Swift. Recently I have written very simple class as shown below for your reference: public class SwiftUser {     let userid: Int     let userfirstName: String     let userlastName: String     ... Return from initializer without initializing all stored properties . Now I am very confused. Please help me in resolving above Swift error.
asked May 12, 2020 Martin K 6.6k points
0 votes
1 answer 813 views
813 views
Problem : I got an error on Xcode saying that there was no information about the view controller as follows: Could not insert new outlet connection: Could not find any information for the class named Why am I getting this error?
asked Nov 28, 2019 alecxe 7.5k points