Skip to main content
Inspiring
April 27, 2016
Answered

Update ANE with AIR 22 is not working anymore

  • April 27, 2016
  • 1 reply
  • 734 views

Hi,

I have a simple ANE which shares File.

It was built with AIR 19.0 and Xcode 6.1.

I want to update to AIR 22, but you have updated the iOS SDK, I have installed XCode 7.3, base SDK is iOS 9.3 and iOS Deployment target is iOS 9.0.

I have a platform.xml like this.

<sdkVersion>9.0.0</sdkVersion>

    <linkerOptions>

        <option>-framework AudioToolbox</option>

        <option>-framework AVFoundation</option>

        <option>-framework CFNetwork</option>

        <option>-framework CoreFoundation</option>

        <option>-framework CoreGraphics</option>

        <option>-framework CoreLocation</option>

        <option>-framework CoreMedia</option>

        <option>-framework CoreVideo</option>

        <option>-framework Foundation</option>

        <option>-framework MobileCoreServices</option>

        <option>-framework OpenGLES</option>

        <option>-framework QuartzCore</option>

        <option>-framework Security</option>

        <option>-framework SystemConfiguration</option>

        <option>-framework UIKit</option>

        <option>-framework ImageIO</option>

        <option>-framework CoreTelephony</option>

    </linkerOptions>

My code to share a file is, in objective-C, where the variable URL is a NSURL, the path of a local file

@try {

  

            UIViewController * controler = [[[[UIApplication sharedApplication] windows] objectAtIndex:0] rootViewController];

          

            UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[URL] applicationActivities:nil];

            //activityVC.excludedActivityTypes = @[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll]; //or whichever you don't need

          

          

            UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activityVC];

            [popup presentPopoverFromRect:CGRectMake(0,0,0,0) inView:controler.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

        }

        @catch (NSException *exception) {

            DISPATCH_STATUS_EVENT(context,"DEBUG_TRACE", (const uint8_t*) [exception.reason UTF8String]);

        }

I have this error at execution: *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]

UIPopoverController is deprecated now, I triied to update my code, following this http://www.goxuni.com/672368-adding-a-share-button-to-an-objective-c-ios-app/ 

And the result is:

@try {

            UIViewController * controler = [[[[UIApplication sharedApplication] windows] objectAtIndex:0] rootViewController];

           

           

            NSArray *activityItems = @[URL];

            UIActivityViewController *activityViewControntroller = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];

            activityViewControntroller.excludedActivityTypes = @[];

           

            activityViewControntroller.modalPresentationStyle = UIModalPresentationFullScreen;

            if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

            {

                activityViewControntroller.popoverPresentationController.sourceView = controler.view;

                activityViewControntroller.popoverPresentationController.sourceRect = CGRectMake(controler.view.bounds.size.width/2, controler.view.bounds.size.height/4, 0, 0);

            }

            [controler.self presentViewController:activityViewControntroller animated:true completion:nil];

           

        }

        @catch (NSException *exception) {

            DISPATCH_STATUS_EVENT(context,"DEBUG_TRACE", (const uint8_t*) [exception.reason UTF8String]);

        }

The error is the same: *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]

I really don't understand why this was working before, and now with new AIR SDK, new Xcode and new iOS SDK, it's not working.

This topic has been closed for replies.
Correct answer Tristan_g_

It's Ok with the latest AIR 22 SDK

Bug#4146925 - ANE compiled with AIR 22 is not working anymore

1 reply

Tristan_g_AuthorCorrect answer
Inspiring
May 12, 2016