ShareKit icon indicating copy to clipboard operation
ShareKit copied to clipboard

IOS 5 Cancel Button

Open opedrero opened this issue 14 years ago • 32 comments
trafficstars

In ios 5 not working Cancel Button from views when load twitter view!

Any idea?!?!?!

Sorry for my english!

opedrero avatar Jun 20 '11 21:06 opedrero

Hi,

I have the same issue as well. The cancel button does not work when authorizing for twitter using oAuth.

rramnel avatar Jun 21 '11 21:06 rramnel

Yes, same here...

raspu avatar Jun 23 '11 01:06 raspu

Same problem. Sugestions?

hdoria avatar Jun 23 '11 16:06 hdoria

Hey everyone,

I've fixed the issue but due to iOS5 being under NDA I'm unable to push out my fix. I will update my fork with the fix once the NDA for 5.0 is lifted though.

-David

bobbypage avatar Jun 25 '11 00:06 bobbypage

This link helped me fix it pretty easily (in SHK.m). I'm OK with posting it because you'd have to be under the NDA to read it anyway: https://devforums.apple.com/message/451045

btedev avatar Jul 11 '11 21:07 btedev

Same problem.

Could you say more btedev ?

hugoclrd avatar Jul 12 '11 21:07 hugoclrd

I don't want to upset the NDA police but I'll be glad to discuss privately. Just message me directly through my GitHub profile.

btedev avatar Jul 13 '11 14:07 btedev

When editing the SHK.m and applying the accepted answer code on https://devforums.apple.com/message/451045 the problem is solved. Thx.

Gerharbo avatar Sep 19 '11 07:09 Gerharbo

What was the solution to this? I looked through the code above, but I wasn't able to get the button to work again.

Thanks!

aslocal avatar Oct 11 '11 22:10 aslocal

Now that the NDA is lifted, I just changed the two instances of [[currentView parentViewController] dismissModalViewControllerAnimated:YES] in SHK.m to [currentView dismissModalViewControllerAnimated:YES].

This gist is my SHK.m: https://gist.github.com/1281191

btedev avatar Oct 12 '11 13:10 btedev

Great, I appreciate it.

aslocal avatar Oct 12 '11 17:10 aslocal

Great, works perfect for iOS5, but now I'm getting an EXC_BAD_ACCESS crash on iOS 4:

Debugger points to: [currentView dismissModalViewControllerAnimated:animated];

ghost avatar Oct 16 '11 01:10 ghost

This needs to have detection on whether it's IOS5 or not to check whether it should be [[currentView parentViewController] dismissModalViewControllerAnimated:YES] or [currentView dismissModalViewControllerAnimated:YES] because it's probably not liking the reference.

sbentzen avatar Oct 16 '11 01:10 sbentzen

After more testing, it appears that this crash only happens in the iOS 4.3 simulator. It works fine on an iPhone 4 running iOS 4.3. Strange.

ghost avatar Oct 16 '11 01:10 ghost

Here's what i did:

if ([currentView respondsToSelector:@selector(presentingViewController)]) [[currentView presentingViewController] dismissViewControllerAnimated:YES completion:NO]; else [[currentView parentViewController] dismissModalViewControllerAnimated:YES];

hdoria avatar Oct 16 '11 11:10 hdoria

@corvino 's fix is working perfectly here. Thanks!! ;)

gil avatar Oct 25 '11 21:10 gil

Working here too. Thanks a lot!

scurioni avatar Nov 02 '11 02:11 scurioni

Working great ! Thank you !

gonzooin avatar Nov 07 '11 18:11 gonzooin

Thanks @corvino for the patch!

justinxreese avatar Nov 09 '11 16:11 justinxreese

it works perfect, thank you!!!

patoroco avatar Nov 10 '11 09:11 patoroco

Thank you so much!

johnozbay avatar Jan 03 '12 21:01 johnozbay

Here's what I did for having it runnable on ios5 and ios4. // Dismiss the modal view if ([currentView parentViewController] != nil) { self.isDismissingView = YES; [[currentView parentViewController] dismissModalViewControllerAnimated:animated]; } else if([currentView respondsToSelector:@selector(presentingViewController)]) { self.isDismissingView = YES; [[currentView presentingViewController] dismissModalViewControllerAnimated:animated]; } else { self.currentView = nil; }

also, because the delegate doesn't work for static functions, I modified those two functions to be(SHKActionSheet.xx) :

  • (SHKActionSheet *)actionSheetForType:(SHKShareType)type;
  • (SHKActionSheet *)actionSheetForItem:(SHKItem *)i;

carol8421 avatar Feb 18 '12 16:02 carol8421

parentViewController

Prior to iOS 5.0, if a view did not have a parent view controller and was being presented modally, the view controller that was presenting it would be returned. This is no longer the case. Use the presentingViewController property to access the presenting view controller.

I'm replace parentViewController with presentingViewController and all will be ok

Vitalii-Gozhenko avatar Feb 19 '12 17:02 Vitalii-Gozhenko

thnx Magnat12 - replacing parentViewController with presentingViewController works in my case!

headkit avatar Feb 26 '12 16:02 headkit

still not working for me in iOS5.1 (using ARC w/ -fno-objc-arc)

It looks like CurrentView in SHK isn't getting set correctly

mclark4386 avatar Mar 24 '12 07:03 mclark4386

to all: better way now is use new version of ShareKit: https://github.com/ShareKit/ShareKit Where added iOS5 support, Twitter framework in iOS5 and many other improvements and bug fixed

Vitalii-Gozhenko avatar Mar 24 '12 07:03 Vitalii-Gozhenko

Thanks @btedev It works

vssranganadhp avatar Aug 09 '12 06:08 vssranganadhp

@corvino Thank you very much! Works perfectly!

sunnyssrcp avatar Aug 26 '12 12:08 sunnyssrcp

having same issue as mclark4386 ... ? any updates ?

akdoshi avatar Sep 19 '12 05:09 akdoshi

i have debug and found the issue you need to add this code in SHK.m file in hideCurrentViewControllerAnimated function line no 183

if ([currentView parentViewController] != nil) { self.isDismissingView = YES; [currentView dismissModalViewControllerAnimated:YES]; //[[currentView parentViewController] dismissModalViewControllerAnimated:animated]; }

    else
    {
        [currentView dismissModalViewControllerAnimated:YES];
        self.currentView = nil;
    }

I have added just one line in else part previously it was just else { self.currentView = nil; }

akdoshi avatar Sep 19 '12 05:09 akdoshi

@corvino: thank you a lot.

teoco avatar Sep 21 '12 02:09 teoco

thanks for all of you.. I hope I can serve all of you some time..

jalmatari avatar Jan 02 '13 00:01 jalmatari