Forum Xamarin.iOS

Simulator Compiles and runs app, Add-Hoc / Distribution fails native compilation

NicholasJory.5423NicholasJory.5423 GBMember, University
edited April 2014 in Xamarin.iOS

Hi there,

I have an application that requires several hundred different templates. Each one is subclassed and uses a series of subclassed controls.
It works perfectly on my simulator which ever way I do it.
When I deploy it bombs out when I use this code (which would the best option):

    private object SwitchTemplate2(string className)
    {
        var assembly = System.Reflection.Assembly.GetExecutingAssembly();
        var type = assembly.GetTypes().First(t => t.Name == className);
        return Activator.CreateInstance(type);
    } 

I thought that this reflection access would work...? In an attempt to work around this I implemented a switch statement:

    private TemplateBase SwitchTemplate(string className)
    { 
        TemplateBase result;

        switch (className) { 
        // case "FR_MD_S_02_01_03_1_101367_0": result = new FR_MD_S_02_01_03_1_101367_0 (); break;
        case "S2HD_S_02_01_04_1_2671_0": result = new S2HD_S_02_01_04_1_2671_0 (); break;
        case "S2HD_S_02_01_03_1_1671_0": result = new S2HD_S_02_01_03_1_1671_0 (); break;
        case "S2MD_S_02_01_03_1_1367_0": result = new S2MD_S_02_01_03_1_1367_0 (); break;
        case "S2MD_S_02_01_04_1_2367_0": result = new S2MD_S_02_01_04_1_2367_0 (); break;
        case "S2MD__10001_0": result = new S2MD__10001_0 (); break;
        case "S2MD__11001_0": result = new S2MD__11001_0 (); break;
        case "S2MD__12001_0": result = new S2MD__12001_0 (); break;
        default: 
            break;
        }

        return result;

    }

The version above will not compile to native with seven switch items. It will however with any six!

The error given does not make sense to me so any help in resolving this would be greatly appreciated. See below.

Kindest regards,

Nicholas

...

Build complete -- 0 errors, 0 warnings

Compiling to native code
/Developer/MonoTouch/usr/bin/mtouch -sdkroot "/Applications/Xcode.app/Contents/Developer" --cache "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache" --nomanifest --nosign -dev "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/bin/iPhone/Ad-Hoc/SolvencyII_iOS.app" -r "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.Data/bin/Release/SolvencyII.Data.dll" -r "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.Data.Shared/bin/Release/SolvencyII.Data.Shared.dll" -r "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.Domain/bin/Release/SolvencyII.Domain.dll" -r "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS.Lib/bin/Release/SolvencyII_iOS_Lib.dll" -r "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS.Templates/bin/Release/SolvencyII_iOS_Templates.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" -linksdkonly -sdk "7.1" -targetver "7.0" --abi=armv7 "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/bin/iPhone/Ad-Hoc/SolvencyII_iOS.exe"
Xamarin.iOS 7.2.0 Indie Edition using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
Process exited with code 1, command:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Wl,-pie -miphoneos-version-min=7.0 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/SolvencyII_iOS.exe.armv7.o" "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/monotouch.dll.armv7.o" "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/mscorlib.dll.armv7.o" "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/System.dll.armv7.o" "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/System.Core.dll.armv7.o" "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/SolvencyII.Domain.dll.armv7.o" "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/SolvencyII.Data.dll.armv7.o" "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/SolvencyII_iOS_Lib.dll.armv7.o" "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/SolvencyII.Data.Shared.dll.armv7.o" "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/SolvencyII_iOS_Templates.dll.armv7.o" "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/registrar.armv7.o" "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/main.armv7.o" -o "/My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/bin/iPhone/Ad-Hoc/SolvencyII_iOS.app/SolvencyII_iOS" -framework CFNetwork -framework Foundation -framework CoreGraphics -framework UIKit -lz -liconv -u _monotouch_release_managed_ref -u _monotouch_create_managed_ref -u _xamarin_get_block_descriptor -u _monotouch_log /Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonoboehm-2.0.a /Developer/MonoTouch/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonotouch.a -dead_strip
final section layout:
__TEXT/__text addr=0x00008000, size=0x02382480, fileOffset=0x00004000, type=1
__TEXT/__picsymbolstub4 addr=0x0238A480, size=0x00000F90, fileOffset=0x02386480, type=27
__TEXT/__stub_helper addr=0x0238B410, size=0x00000BD0, fileOffset=0x02387410, type=31
__TEXT/__const addr=0x0238BFE0, size=0x0012F7D0, fileOffset=0x02387FE0, type=0
__TEXT/__cstring addr=0x024BB7B0, size=0x0001FA23, fileOffset=0x024B77B0, type=12
__TEXT/__objc_methname addr=0x024DB1D3, size=0x000002E3, fileOffset=0x024D71D3, type=13
__TEXT/__objc_classname addr=0x024DB4B6, size=0x00000038, fileOffset=0x024D74B6, type=13
__TEXT/__objc_methtype addr=0x024DB4EE, size=0x0000003C, fileOffset=0x024D74EE, type=13
__DATA/__nl_symbol_ptr addr=0x024DC000, size=0x00000450, fileOffset=0x024D8000, type=28
__DATA/__la_symbol_ptr addr=0x024DC450, size=0x000003E4, fileOffset=0x024D8450, type=26
__DATA/__const addr=0x024DC838, size=0x000007D0, fileOffset=0x024D8838, type=0
__DATA/__objc_classlist addr=0x024DD008, size=0x0000000C, fileOffset=0x024D9008, type=0
__DATA/__objc_imageinfo addr=0x024DD014, size=0x00000008, fileOffset=0x024D9014, type=0
__DATA/__objc_const addr=0x024DD01C, size=0x000001D0, fileOffset=0x024D901C, type=0
__DATA/__objc_selrefs addr=0x024DD1EC, size=0x0000026C, fileOffset=0x024D91EC, type=14
__DATA/__objc_classrefs addr=0x024DD458, size=0x00000030, fileOffset=0x024D9458, type=22
__DATA/__objc_superrefs addr=0x024DD488, size=0x00000008, fileOffset=0x024D9488, type=0
__DATA/__objc_data addr=0x024DD490, size=0x00000078, fileOffset=0x024D9490, type=0
__DATA/__data addr=0x024DD510, size=0x000156C0, fileOffset=0x024D9510, type=0
__DATA/__cfstring addr=0x024F2BD0, size=0x00000060, fileOffset=0x024EEBD0, type=16
__DATA/__objc_ivar addr=0x024F2C30, size=0x00000014, fileOffset=0x024EEC30, type=0
__DATA/__common addr=0x024F2C44, size=0x00018BD0, fileOffset=0x00000000, type=24
__DATA/__bss addr=0x0250B820, size=0x00006D30, fileOffset=0x00000000, type=24
ld: unexpected bindingNone in '_System_Collections_Generic_Dictionary_2_string_int_get_Item_string' from /My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/SolvencyII_iOS_Templates.dll.armv7.o for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error MT5309: Native linking error: final section layout:
error MT5309: Native linking error: __TEXT/__text addr=0x00008000, size=0x02382480, fileOffset=0x00004000, type=1
error MT5309: Native linking error: __TEXT/__picsymbolstub4 addr=0x0238A480, size=0x00000F90, fileOffset=0x02386480, type=27
error MT5309: Native linking error: __TEXT/__stub_helper addr=0x0238B410, size=0x00000BD0, fileOffset=0x02387410, type=31
error MT5309: Native linking error: __TEXT/__const addr=0x0238BFE0, size=0x0012F7D0, fileOffset=0x02387FE0, type=0
error MT5309: Native linking error: __TEXT/__cstring addr=0x024BB7B0, size=0x0001FA23, fileOffset=0x024B77B0, type=12
error MT5309: Native linking error: __TEXT/__objc_methname addr=0x024DB1D3, size=0x000002E3, fileOffset=0x024D71D3, type=13
error MT5309: Native linking error: __TEXT/__objc_classname addr=0x024DB4B6, size=0x00000038, fileOffset=0x024D74B6, type=13
error MT5309: Native linking error: __TEXT/__objc_methtype addr=0x024DB4EE, size=0x0000003C, fileOffset=0x024D74EE, type=13
error MT5309: Native linking error: __DATA/__nl_symbol_ptr addr=0x024DC000, size=0x00000450, fileOffset=0x024D8000, type=28
error MT5309: Native linking error: __DATA/__la_symbol_ptr addr=0x024DC450, size=0x000003E4, fileOffset=0x024D8450, type=26
error MT5309: Native linking error: __DATA/__const addr=0x024DC838, size=0x000007D0, fileOffset=0x024D8838, type=0
error MT5309: Native linking error: __DATA/__objc_classlist addr=0x024DD008, size=0x0000000C, fileOffset=0x024D9008, type=0
error MT5309: Native linking error: __DATA/__objc_imageinfo addr=0x024DD014, size=0x00000008, fileOffset=0x024D9014, type=0
error MT5309: Native linking error: __DATA/__objc_const addr=0x024DD01C, size=0x000001D0, fileOffset=0x024D901C, type=0
error MT5309: Native linking error: __DATA/__objc_selrefs addr=0x024DD1EC, size=0x0000026C, fileOffset=0x024D91EC, type=14
error MT5309: Native linking error: __DATA/__objc_classrefs addr=0x024DD458, size=0x00000030, fileOffset=0x024D9458, type=22
error MT5309: Native linking error: __DATA/__objc_superrefs addr=0x024DD488, size=0x00000008, fileOffset=0x024D9488, type=0
error MT5309: Native linking error: __DATA/__objc_data addr=0x024DD490, size=0x00000078, fileOffset=0x024D9490, type=0
error MT5309: Native linking error: __DATA/__data addr=0x024DD510, size=0x000156C0, fileOffset=0x024D9510, type=0
error MT5309: Native linking error: __DATA/__cfstring addr=0x024F2BD0, size=0x00000060, fileOffset=0x024EEBD0, type=16
error MT5309: Native linking error: __DATA/__objc_ivar addr=0x024F2C30, size=0x00000014, fileOffset=0x024EEC30, type=0
error MT5309: Native linking error: __DATA/__common addr=0x024F2C44, size=0x00018BD0, fileOffset=0x00000000, type=24
error MT5309: Native linking error: __DATA/__bss addr=0x0250B820, size=0x00006D30, fileOffset=0x00000000, type=24
error MT5309: Native linking error: unexpected bindingNone in '_System_Collections_Generic_Dictionary_2_string_int_get_Item_string' from /My Shared/My Documents/iOS Development/EIOPA/SolvencyII.iOS/SolvencyII.iOS/obj/iPhone/Ad-Hoc/mtouch-cache/SolvencyII_iOS_Templates.dll.armv7.o for architecture armv7
error MT5202: Native linking failed. Please review the build log.

---------------------- Done ----------------------

Build: 26 errors, 0 warnings

Posts

  • JasonAwbreyJasonAwbrey USInsider, University, Developer Group Leader mod

    You'd be better off posting this in the iOS forum.

  • NicholasJory.5423NicholasJory.5423 GBMember, University
    edited April 2014

    I have made progress on this. The reflection code works.
    The problem seems to be with the shear size of the program - or at least the way its been setup for compilation.
    By simply removing a vast number of templates everything works perfectly.
    The next question is what build parameter / setting etc needs to change to put them all back in again.

Sign In or Register to comment.