Skip to main content
Participant
October 30, 2011
Question

iOS Blocks do not work in Native Extensions

  • October 30, 2011
  • 5 replies
  • 13989 views

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(MobileImagePicker.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

This topic has been closed for replies.

5 replies

SourceSkyBoxer
Known Participant
January 13, 2012

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.

January 13, 2012

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

SourceSkyBoxer
Known Participant
January 13, 2012

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..

Inspiring
January 5, 2012

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

Participating Frequently
December 28, 2011

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.

December 28, 2011

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.

marchbold
Inspiring
January 13, 2012

Hey fabian3,

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

air native extensions // https://airnativeextensions.com
Inspiring
December 28, 2011

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...

Participating Frequently
November 22, 2011

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

December 17, 2011

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.