AliSherKashif / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

ShareButton not working with newVM=true #1338

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Mi app is crashing with newVM every time the user taps a ShareButton. The same 
code is working fine with the old VM.

Tested with iPad Mini iOS 8.1.3

This simple test case reproduces the problem for me:

package com.Test;

import com.codename1.components.ShareButton;
import com.codename1.ui.Display;
import com.codename1.ui.Form;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.Resources;
import java.io.IOException;

public class MyApplication {

    private Form current;

    public void init(Object context) {
        try {
            Resources theme = Resources.openLayered("/theme");
            UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
        } catch(IOException e){
            e.printStackTrace();
        }
    }

    public void start() {
        if(current != null){
            current.show();
            return;
        }        
        ShareButton comparte = new ShareButton();
        comparte.setText("Share");                                
        comparte.setTextToShare("Hello");        
        Form hi = new Form("Hi World");     
        hi.setLayout(new BorderLayout());
        hi.addComponent(BorderLayout.CENTER, comparte);
        hi.show();
    }

    public void stop() {
        current = Display.getInstance().getCurrent();
    }

    public void destroy() {
    }

}

Original issue reported on code.google.com by cverd...@gmail.com on 6 Feb 2015 at 6:01

GoogleCodeExporter commented 9 years ago
Looking at this now. 
The test case works fine on an iPhone 4S running iOS 8.1.2.
Test case produces a crash running on iPad 2 simulator (Xcode) running 8.1. 
Looking into it further.  Will post results. 

So this is iPad-specific.

Original comment by st...@weblite.ca on 6 Feb 2015 at 6:19

GoogleCodeExporter commented 9 years ago

Original comment by st...@weblite.ca on 6 Feb 2015 at 6:19

GoogleCodeExporter commented 9 years ago
Error readout:
2015-02-06 10:21:18.511 Issue1338Test[23010:19670580] *** Terminating app due 
to uncaught exception 'NSGenericException', reason: 
'UIPopoverPresentationController 
(<_UIAlertControllerActionSheetRegularPresentationController: 0x7ab6a070>) 
should have a non-nil sourceView or barButtonItem set before the presentation 
occurs.'
*** First throw call stack:
(
    0   CoreFoundation                      0x05999946 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x054baa97 objc_exception_throw + 44
    2   UIKit                               0x02a53e47 -[UIPopoverPresentationController presentationTransitionWillBegin] + 3086
    3   UIKit                               0x02356385 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 1666
    4   UIKit                               0x02354968 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 226
    5   UIKit                               0x023887ab __40+[UIViewController _scheduleTransition:]_block_invoke + 18
    6   UIKit                               0x0224e0ce ___afterCACommitHandler_block_invoke + 15
    7   UIKit                               0x0224e079 _applyBlockToCFArrayCopiedToStack + 415
    8   UIKit                               0x0224de8e _afterCACommitHandler + 545
    9   CoreFoundation                      0x058bc9de __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    10  CoreFoundation                      0x058bc920 __CFRunLoopDoObservers + 400
    11  CoreFoundation                      0x058b235a __CFRunLoopRun + 1226
    12  CoreFoundation                      0x058b1bcb CFRunLoopRunSpecific + 443
    13  CoreFoundation                      0x058b19fb CFRunLoopRunInMode + 123
    14  GraphicsServices                    0x091a224f GSEventRunModal + 192
    15  GraphicsServices                    0x091a208c GSEventRun + 104
    16  UIKit                               0x022248b6 UIApplicationMain + 1526
    17  Issue1338Test                       0x00fe7c41 com_codename1_impl_ios_IOSNative_initVM__ + 129
    18  Issue1338Test                       0x001ad56d com_codename1_impl_ios_IOSImplementation_postInit__ + 333
    19  Issue1338Test                       0x0019455c virtual_com_codename1_impl_CodenameOneImplementation_postInit__ + 92
    20  Issue1338Test                       0x005f59d2 com_codename1_ui_Display_init___java_lang_Object + 15314
    21  Issue1338Test                       0x003c738c com_codename1_issue1156_Issue1338TestStub_main___java_lang_String_1ARRAY + 1628
    22  Issue1338Test                       0x003c7434 main + 52
    23  libdyld.dylib                       0x06187ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

Original comment by st...@weblite.ca on 6 Feb 2015 at 6:22

GoogleCodeExporter commented 9 years ago
This seems to be the issue:  
http://stackoverflow.com/questions/25644054/uiactivityviewcontroller-crashing-on
-ios8-ipads
Working on a fix now.

Original comment by st...@weblite.ca on 6 Feb 2015 at 6:57

GoogleCodeExporter commented 9 years ago
Fixed. 
https://code.google.com/p/codenameone/source/detail?r=2094

Will be included in next server update.

iPad/iOS8.1/64-bit apps now use a popover style dialog. (screenshot attached).

Original comment by st...@weblite.ca on 6 Feb 2015 at 8:06

Attachments:

GoogleCodeExporter commented 9 years ago
Great! Thank you, Steve.

Original comment by cverd...@gmail.com on 6 Feb 2015 at 8:09