Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close Button doesn't work in Swift #9

Closed
omardlhz opened this issue Mar 15, 2015 · 31 comments
Closed

Close Button doesn't work in Swift #9

omardlhz opened this issue Mar 15, 2015 · 31 comments
Assignees
Labels

Comments

@omardlhz
Copy link

@omardlhz omardlhz commented Mar 15, 2015

I've read all the issues and I still cant manage to make the close button work. I imported the PopUpViewController.xib and the PopUpViewControllerSwift.swift files, do I need to import any other files?

@psy2k psy2k added the question label Mar 16, 2015
@psy2k psy2k self-assigned this Mar 16, 2015
@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Mar 16, 2015

@omardlhz In order to use the Swift version, you have to import the PopUpViewControllerSwift.Swift file and all the .xibs and make sure that the IBAction for the close button is connected.
popup

See the DemoViewController.swift for how to initialize and use the PopUp in your View Controller. Let me know if the issue still exists.

@rizwan95

This comment has been minimized.

Copy link

@rizwan95 rizwan95 commented Jun 12, 2015

I am also expereincing the same issue. Everything is fine but when the close button is clicked , the app crashes.

@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Jun 13, 2015

@rizwan95 can you post the crash log?

@rizwan95

This comment has been minimized.

Copy link

@rizwan95 rizwan95 commented Jun 13, 2015

The error which I get after I press the close button is, Thread 1 : Exc_Bad_Access(Code=EXC_i386_GPFLT) in the app delegate class.

@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Jun 13, 2015

@rizwan95 enable breakpoints exceptions in the exceptions tab and please post the line where the crash occurs.

screen shot 2015-06-13 at 15 12 51

@sorennorup

This comment has been minimized.

Copy link

@sorennorup sorennorup commented Jun 16, 2015

I'm also interested in a fix of this issue with the close button.

@jameswalkerkerr

This comment has been minimized.

Copy link

@jameswalkerkerr jameswalkerkerr commented Jun 17, 2015

I am having the same issue. Here is the zombie message that I am given: "An Objective-C message was sent to a deallocated 'DealPeel.PopUpViewControllerSwift' object (zombie) at address: 0x126d42880. ". My app name is 'DealPeel'.

Here are the messages is in the console:
screen shot 2015-06-17 at 5 55 10 pm

@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Jun 18, 2015

@jameswalkerkerr the popUp is deallocated. Are you declaring it as a weak property?

@break2k

This comment has been minimized.

Copy link

@break2k break2k commented Jul 7, 2015

any progress here ?

@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Jul 7, 2015

@break2k can you set a exception breakpoint and post here the code that causes the crash?

@einali

This comment has been minimized.

Copy link

@einali einali commented Jul 20, 2015

pls fix this issue

@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Jul 20, 2015

@einali please see the above answer and post the line that causes the crash using an exception breakpoint.

@Marcellsantoso

This comment has been minimized.

Copy link

@Marcellsantoso Marcellsantoso commented Aug 4, 2015

i still can't get the error log, it's only showing Exc_Bad_Access(Code=EXC_i386_GPFLT), and i've tried adding the exception breakpoint, and it's still like that.
Please help :(

@Kecemen

This comment has been minimized.

Copy link

@Kecemen Kecemen commented Aug 11, 2015

We just need #import "NMPopUpView-Swift.h" this class how can i import this ?

@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Aug 11, 2015

@Kecemen if you are using swift classes in your objectivec classes you have to import the -Swift.h generated header in your objective-c classes (only where you want to use your swift classes_. This header is named YourProjectName-Swift.h. For example if your project is named "Kecemen" your swift header will be Kecemen-Swift.h.

@Kecemen

This comment has been minimized.

Copy link

@Kecemen Kecemen commented Aug 11, 2015

screen shot 2015-08-11 at 18 26 49

Nevermind i decide to use obj-c class and i changed .xib file class. Also, import

#import "PopUpViewController.h"
PopUpViewController *popViewController = [[PopUpViewController alloc]
initWithNibName:@"PopUpViewController" bundle:nil];
[popViewController setTitle:@"This is a popup view"];
[popViewController showInView:self.view
withImage:[UIImage imageNamed:@"yourImage"]
withMessage:@"Your Message" animated:YES];

this code part.

Popup show working but when i click close app crashed.
Than i delete close button action connection than i run. this time, when i click close app not crash but close button do nothing. I cound't find error ?

@Kecemen

This comment has been minimized.

Copy link

@Kecemen Kecemen commented Aug 11, 2015

I fixed problem create UIView and set on .xib view and than set button action
screen shot 2015-08-11 at 18 30 02
screen shot 2015-08-11 at 18 30 56

Now popup closed. If anyone want i can send my code.

@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Aug 11, 2015

@Kecemen you can patch the example of the repo and submit a pull request here if you want :-)

@Kecemen

This comment has been minimized.

Copy link

@Kecemen Kecemen commented Aug 12, 2015

I created pull request but i don't know how can i download my codes.

@Brain2success

This comment has been minimized.

Copy link

@Brain2success Brain2success commented Sep 4, 2015

So.... What is the solution in the Swift language?

@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Sep 4, 2015

@Brain2success a new version will be available soon, with cocoapods support and it will be only, which will fix this issue. Meanwhile just disconnect the close action from the .xibs and add it again.

@Brain2success

This comment has been minimized.

Copy link

@Brain2success Brain2success commented Sep 4, 2015

Well tanks for the quick response! Instead of disconnect and add it again, I added a new UIButton and connected to the swift file. Just with a simple println("test"). But it also resolve in the same error.

@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Sep 5, 2015

@Brain2success what error are you getting? I am unable to reproduce this. If you can put a debug breakpoint and send me the line that crashes it will be great. Also if you are able to reproduce this issue in a test product and upload it here, you can give me access and I will be able to see what is going wrong.

@psy2k psy2k added the bug label Sep 5, 2015
@Brain2success

This comment has been minimized.

Copy link

@Brain2success Brain2success commented Sep 5, 2015

https://github.com/Brain2success/popUpView.git here you find a simple test product I even added a extra button like i did in the original.

@Brain2success

This comment has been minimized.

Copy link

@Brain2success Brain2success commented Sep 9, 2015

@psy2k did you tried the link I send you? And are you able to reproduce the error?

@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Sep 9, 2015

@Brain2success the problem is that you declare the popUpViewController property in the method where you calling it. That causes it to be released after presenting, so the close action is sent to a deallocated instance which causes a crash. Declare the property in the class variables from where you are going to call the popup var popViewController = PopUpViewControllerSwift(nibName: "PopUpViewController_iPad", bundle: nil) and in the method. If your viewcontroller is written in ObjC declare the popup property in the interface with a strong reference.

@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Sep 9, 2015

@Brain2success I will commit the fix to your repository so anyone here can see whats changed (You have to give me push access to the repo for that). The correct implementation is also available in the examples provided by this repo.

@psy2k psy2k closed this Sep 9, 2015
psy2k added a commit that referenced this issue Sep 9, 2015
Provide more accurate instructions on where the popUp var should be declared. Fixes and closes #9
@Brain2success

This comment has been minimized.

Copy link

@Brain2success Brain2success commented Sep 10, 2015

Hello,

I think you should have access to the files now. Is that correct?

Brain2Success

On wo, sep. 9, 2015 at 11:33 p.m., psy2k/NMPopUpView reply@reply.github.com wrote:

Closed #9#9.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#event-405320843.

@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Sep 10, 2015

@sai487

This comment has been minimized.

Copy link

@sai487 sai487 commented Aug 24, 2016

@Kecemen please send ur code
my mail id is saikrishna.tadavarthy@gmail.com

@psy2k

This comment has been minimized.

Copy link
Owner

@psy2k psy2k commented Aug 28, 2016

@sai487 you can subclass the popup so you can override the close function and add custom code for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.