Dynamically loading frameworks?

rschmidtrschmidt USMember ✭✭

Does Xamarin support dynamically loading frameworks? iOS 8 supports it, but I see nothing in the Xamarin documentation. Is support planned?


  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    Support is planned, but we haven't implemented it yet.

  • AnatoliAlbulAnatoliAlbul USMember

    Any new information related to support dynamically loading frameworks?

  • DougCochranDougCochran USMember
    edited March 2015

    Would be nice to know Xamarin status of dynamically loading frameworks support in iOS8, as this should help us with Apple's 64 bit requirement by June 1. Our app is over the executable size maximum of 80MB, so hoping we can dynamically link the framework to help reduce our "over the limit" executable.

    Thanks in advance.

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @DougCochran: the 80MB limit is per architecture, this means you have 80MB for armv7 code + 80MB for arm64 code.

  • DougCochranDougCochran USMember
    edited April 2015

    We submitted our armv7 + arm64 build to Apple and it was rejected due to being over the maximum executable size limit of 80MB total. So it seems we are not allowed 80MB per architecture (total 160MB) but still limited to 80MB? See attached screen shot as submitted to Apple and rejection error. We are at 115MB with armv7 and arm64 architectures, so they are not allowing 80MB x 2 architectures it seems? Again, dynamically loading frameworks should help us here.

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @DougCochran: another customer [1] got a confirmation from Apple that the size limit is per (architecture) slice.

    Can you run the size -arch all /path/to/executable command and check the output?

    [1] https://forums.xamarin.com/discussion/comment/112815/#Comment_112815

  • DougCochranDougCochran USMember

    Unfortunately it seems that Apple does not allow 60MB size limit per slice, but 80MB maximum executable file size combined. See screenshot of resubmitted app to Apple today.

    Running the "size -arch all ...." command shows that our armv7 and arm64 size as 59MB and 52MB respectively, so would have passed if Apple did in fact allow 60MB per architecture/slice x 2. More Info on size command below:

    "size -arch all TurboSitePreview.app/TurboSitePreview
    __TEXT __DATA __OBJC others dec hex
    59785216 2031616 0 5799936 67616768 407c000 TurboSitePreview.app/TurboSitePreview (for architecture armv7)
    52281344 3620864 0 4299177984 4355080192 103954000 TurboSitePreview.app/TurboSitePreview (for architecture arm64)"

    So back to the original question: Hopefully dynamically shared framework support in Xamarin will solve our woes before June 1 2015.

    In addition, here are the screenshots from Apple's Application Loader.

  • rschmidtrschmidt USMember ✭✭

    @DougCochran I just successfully ran our app through the app store validation checks. Size for it outputs:

    __TEXT __DATA __OBJC others dec hex
    49168384 1015808 0 970752 51154944 30c9000 xx (for architecture armv7)
    48316416 1966080 0 4295835648 4346118144 1030c8000 xx (for architecture arm64)

    We have reason to believe that the limit is 60 MB for armv7 apps and 80 MB for arm64 apps. The TEXT segment of your armv7 app is alarmingly close to 60 MB. I think that's why it's failing. I've heard that the app store submission process does some kind of processing that increases your app size before it calculates the size.

    Whatever the case may be, it does for sure look like you need to get app size down somehow. The 10 MB I have left before hitting the 60 MB limit doesn't make me all that comfortable, either.

  • DougCochranDougCochran USMember

    Interesting, we'll see if we can shave some MB's off our armv7 slice and see what happens. We'll get back with the results.

    thanks for sharing your info!

  • DougCochranDougCochran USMember

    Well, I was able to shave about 7MB-9MB from armv7 and arm64, but still rejected. Perhaps 53MB is still too close to 60MB during Apple process?

    size -arch all TurboSitePreview.app/TurboSitePreview
    __TEXT __DATA __OBJC others dec hex
    53559296 1949696 0 5701632 61210624 3a60000 TurboSitePreview.app/TurboSitePreview (for architecture armv7)
    47923200 3489792 0 4299112448 4350525440 1034fc000 TurboSitePreview.app/TurboSitePreview (for architecture arm64)

    Submitted and rejection error again....

  • rschmidtrschmidt USMember ✭✭

    @DougCochran That's surprising to me. Looking more closely, the warning you're getting does seem to imply that it's comparing your whole executable to the 80 MB limit. I wonder if it's somehow thinking your binary is not a fat one. Might it be that you're using an older version of the application loader? I'm using version 3.0. There's an "About Application Loader" under the Application Loader menu.

  • DougCochranDougCochran USMember

    @rschmidt , Using a newer version of Application Loader v3.1

    Also please note that we submitted our 67MB armv7 executable with no problems to Apple (missing 64 bit support of course). So I don't believe there is a 60MB limit for armv7, but 80MB combined (armv7 + arm64)

    Strange, since your combined architecture slices are over 80MB, your binary should be rejected as well. Can you confirm your total executable size by "showing contents" of your app and checking the total size of your executable?


  • rschmidtrschmidt USMember ✭✭

    @DougCochran doing "Get Info" on the executable in Finder says that it's 101,857,920 bytes. The size command responds as posted above and lipo -detailed_info shows

    architecture armv7
        cputype CPU_TYPE_ARM
        cpusubtype CPU_SUBTYPE_ARM_V7
        offset 16384
        size 50971808
        align 2^14 (16384)
    architecture arm64
        cputype CPU_TYPE_ARM64
        cpusubtype CPU_SUBTYPE_ARM64_ALL
        offset 51003392
        size 50854528
        align 2^14 (16384)
  • DougCochranDougCochran USMember

    @rschmidt: Interesting, at 101,857,920 bytes, you would be over Apple's 80MB executable limit. Since we've tested and passed Apple checks with >60mb armv7 with success, and still get rejected with less than 60MB armv7 + 42MB arm64, I'm still confused how you can pass Apple submission checks and we still fail due to 80MB limit?

    Have you actually submitted your app with Application Loader v3.1 or higher?

  • rschmidtrschmidt USMember ✭✭

    @DougCochran I updated Application Loader to v3.1 (the latest version) and uploaded my app again successfully. It is in iTunes Connect with the binary state marked as validated.

    At this point you may want to stop by the Apple dev forum and ask for help there.

    The last suggestion I have is to try raising your minimum supported OS version if it's something low.

  • DougCochranDougCochran USMember

    Just to update this thread and provide clarification on Apple's maximum allowed executable file size and architecture slices. A Sr. Advisor at Apple Developer Program Support, has provided me with the following info (see image attached). Basically 80MB maximum total for all architecture slices (and not per architecture). Which puts us back to zero.

    ...Now where were we with Xamarin support for dynamic framework support?..... (help :)

  • DougCochranDougCochran USMember

    @rschmidt @RolfBjarneKvinge @AnatoliAlbul

    Ok, Figured it out and thought I would share this info!

    1. Allowed Executable size is 60MB per slice as long as your Target is >= iOS 7. (We had our Target set to iOS 5.2)
    2. In such case if Target is not >=iOS 7, then its 80MB total exectuable size combined.

    So our executable is 130MB with 58MB armv7 and 53MB arm64, so we pass error checks now.

    Here is info from Apple tech support:

    _"Hi Doug,

    For applications with a deployment target >= to iOS 7.0, the limit is 60 MB per slice. For applications with a lower deployment target, the limit is 60MB (Note: this has been updated to 80MB total I believe) total (the sum of all slices).

     Apple Inc. | Apple Developer Technical Support"_

  • rschmidtrschmidt USMember ✭✭

    @DougCochran Thanks for sharing. There's no way to know without bugging Apple some more, but doing some Egyptology on the response you received and responses we've received on the same question, I wonder if the limit for >= iOS 7.0 has also been updated to 80 MB per slice, and the part in parentheses was either meant to apply to the previous sentence also or if it was accidentally left off in that case. I really wish they would just update their documentation with an official answer.

  • DougCochranDougCochran USMember

    @rschmidt, received confirmation that its 60MB per architecture for deployment targets of iOS 7 and higher or 80MB maximum executable (total) for deployments less than iOS 7.


  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @DougCochran, This is very interesting, thanks for letting us know the response from Apple!

Sign In or Register to comment.