Skip navigation
Omnipitence
Currently Being Moderated

iOS Blocks do not work in Native Extensions

Oct 30, 2011 4:38 PM

Tags: #air #mobile #ios #native_extensions #nativeextension

Hi Guys,

I think i have found a bug in the current Native Extensions implementation.

Basically if you add an iOS 4 style block to your code then FlashBuilder can't build the project I get an error like this.

 

ld: absolute addressing (perhaps -mdynamic-no-pic) used in -[MobileImagePicker searchForAlbums] from /var/folders/nw/nwjKk-0UFzKXgLSHtcbjxE+++TI/-Tmp-/530e198b-499e-4ee1- afb3-e566ea8d2bf3/libuk.co.betadesigns.extension.NativeImagePicker.a(M obileImagePicker.o) not allowed in slidable image. Use '-read_only_relocs suppress' to enable text relocs

Compilation failed while executing : ld64

 

 

In order to get rid of this error I had to set  "Enable Linking with shared libraries" to NO which allows the application to build however as soon as i call context.createExtensionContext() the Application exits.

 

 

Has anyone managed to get blocks working in an IOS extension?

 

 

Any help or ideas would be much appreciated.

Thanks

Anthony

 
Replies
  • Currently Being Moderated
    Nov 22, 2011 7:01 AM   in reply to Omnipitence

    Did you figure anything out? I'm hitting the same issue.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 17, 2011 8:35 AM   in reply to rusty120

    Same issue here.

     

    I am building a Native Extension to get PushNotifications in Flex Apps

    and would be done now, if it wasn't for this problem.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 28, 2011 10:40 AM   in reply to Omnipitence

    I have the same problem, the worst is that in an earlier version of my ANE work without this error. Have you learned anything?

     

    If I disable linking with shared libraries get other error...

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 28, 2011 11:03 AM   in reply to Omnipitence

    Not sure if my issue was exactly the same. I did get the same error/crash though. My experience was everything worked until I tried to link with a foundation class. I ended up uninstalling XCode 4.2 and re-installing 4.1. Everything works fine now. After re-installing 4.1, I copied it to new directory /developer-4.1  and reinstalled 4.2. I have to use 4.1 to build the native extension, but still use 4.2 for everything else. Can't say I really know why extensions built with 4.2 where failing.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 28, 2011 12:22 PM   in reply to rusty120

    I have written a Native Extension using XCode 4.2, AIR SDK 3.1 and Flashbuilder 4.6.

    The extension can do the registration for Apple Push Notification Services and transport

    the device token up to the Flex coding layer.

     

    Initially, I wanted to do it, using the FREDispatchStatusEventAsync method, that I would

    call from

    ----------------------------

    - (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

         

      }

    ----------------------------

    and use a custom event at the Flex/Actionscript layer to receive the token, once it has

    been sent to the device.

     

    In order to do that, you must implement the UIApplicationDelegate Protocol

    ------------------------------------------------

    #import <UIKit/UIKit.h>

    #import "FlashRuntimeExtensions.h"

     

    @interface UINativePushAppDelegate : NSObject <UIApplicationDelegate>

     

    @property(nonatomic, assign) id<UIApplicationDelegate> delegate;

    ------------------------------------------------

     

    and call something like

    --------------------------------

    delegate = [[UINativePushAppDelegate alloc] init];

         [[UIApplication sharedApplication] setDelegate:delegate];

    ----------------------------------

    from your static library.

     

     

    But, when I called FREDispatchStatusEventAsync from didRegisterForRemoteNotificationsWithDeviceToken

    the application would crash. I was able to call FREDispatchStatusEventAsync from the static context though.

    I solved this problem by saving the device token in a variable and calling a getter method from the Actionscript

    layer.

     

    This means, of course, that I have to guess the time it takes, until the device token has been sent to the device

    or call the method in a loop, until it does not return null or something.

     

    For the sake of better handling I tried to implement a timer within the objective-c part of my native extension.

    But that wasn't possible as well, because it seems that some parts of the code I needed to use for that - basically

    the clock - are realized as a shared object. Which was a problem, because the compiler option

    "Enable linking with shared libraries" had to be turned of, or the application would crash, soon after launching the application and without this option I would get an error message from Flexbuilder on the final packaging process that should produce the ipa-File, telling me, that the file could not be built. (The error message was crap, and told me to try two different compiler flags that obviously would not solve my problem, as one was related to the mips architecture and the other... I don't remember)

     

    I would be glad to help fixing this, so If anyone responsible needs more detail, feel free to ask.

     

     

     

     

    Am 12/28/11 8:03 PM, schrieb rusty120:

     

    Re: iOS Blocks do not work in Native Extensions

    created by rusty120 in Flex - View the full discussion

    Not sure if my issue was exactly the same. I did get the same error/crash though. My experience was everything worked until I tried to link with a foundation class. I ended up uninstalling XCode 4.2 and re-installing 4.1. Everything works fine now. After re-installing 4.1, I copied it to new directory /developer-4.1  and reinstalled 4.2. I have to use 4.1 to build the native extension, but still use 4.2 for everything else. Can't say I really know why extensions built with 4.2 where failing.

    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: [http://forums.adobe.com/message/4106905#4106905]

    To unsubscribe from this thread, please visit the message page at [http://forums.adobe.com/message/4106905#4106905]. In the Actions box on the right, click the Stop Email Notifications link.

    Start a new discussion in Flex by email or at Adobe Forums

    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

     

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 29, 2011 2:16 AM   in reply to rusty120

    I think if this be, because before I had the 4.1 and it worked, now the 4.2 is not working ... You know where I can download the 4.1?

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 29, 2011 5:06 AM   in reply to undereyes

    Not clear, dude. Can you be a bit more precise? What did you have working, what Objective-C classes/methods did you use? Did you use Flashbuilder 4.6? So far, I got, that you used XCode 4.1.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 5, 2012 4:47 AM   in reply to Omnipitence

    I checked and, if you use the previous Xcode to 4.2 runs smoothly.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 12, 2012 9:41 PM   in reply to fabian3

    Hey fabian3,

     

    I've encountered the same problem, have you had any luck in resolving as yet?

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 12, 2012 10:05 PM   in reply to Omnipitence

    Hello guys,

     

    what does it happen? iPhone - Please make sure - if your iOS updated?

    Check out: http://9to5mac.com/2011/10/12/apple-releases-xcode-4-2-with-ios-5-and- lion-sdks/

     

    I recommand you because you need upgraded version of iOS - You can try sure. If you have problem with XCode 4.2

    Please make sure:

    1. Find Uninstaller for XCode 4.2

    2. Uninstall XCode 4.2

    3. Find error or worng acces denied plist Files from /Users/<User>/Library/Preferences/ and remove "xcode.....plist" Important way: If you can not delete there than you get Root Admin ( Sudo ) and delete again...

    4. Delete /Applications/"Developer" or /"Developer"

    5. Can you reistart now - You can reinstall XCode 4.2 and try coding with Air native extensions sure.

     

    I am sorry - i am using Mac OS X under VirtualBox 4.1.8 - It is not Hackintoch. I have been bought Snow Leopard DVD. I will try next good time. I am deaf

     

    Thanks and i hope you because my suggestion can help for you

     

    Best regards, Jens E.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 13, 2012 1:18 AM   in reply to michaelarchbold

    Read my entire post. I resolved by using a workaround. I saved the device token in a variable

    and called a getter method from Actionscript layer. Events work basically, but you can't call

    them from all possible contexts, as for example the application crashes, when you do it

    from didregisterwithdevicetoken method.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 13, 2012 1:21 AM   in reply to Jens Eckervogt

    Dude, this is neither english nor an answer in respect of the current state of this discussion.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 13, 2012 2:17 PM   in reply to fabian3

    Sorry I wasn't specific enough. We are using a similar technique to store the device token and retrieve it directly from the AS. But we are encountering some additional problems.

     

    If we set the delegate in the ContextInitializer function and create the extension context in the main actionscript application constructor, the application crashes with a stageLoaded error, seems there must be some default ANE stuff done via the app delegate ?

     

    If we delay the extension creation, the delegation works, but we can't seem to call any of the FRE functions after that? Do these work for you?

     

    Thanks for your response by the way!

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 13, 2012 3:54 PM   in reply to fabian3

    Hey @fabian3,

    Okay i understand currectly. I am sorry - You mean because Xcode has error or problem. I don't know what do you say

     

    @mic.archbold, It is ok. And does it work for you? Did you try with ane extension for platform="Mac-x86"> ... </platform> when your iOS Application works?

    I am sorry because i am not advanced Developer for Mac OS X. I am Developer for Windows 7 and Visual Studio.

     

    Thanks. I leave here..

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points