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
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.
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 discussionNot 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.
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.
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.
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!
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.. ![]()
North America
Europe, Middle East and Africa
Asia Pacific