Custom Module: How to use IOS6 functionalities that don't make the app crash when running previous version?

You must Login before you can answer or comment on any questions.

Hi,

I'm developing a custom module for iPhone and I'm very confused about the SDK/iOS versions. I have some functionality that works in a way in iOS5 and in another way in iOS6. So I'm using the iOS6 SDK to develop the module, but I want devices with both iOS to use it.

When I try to use the module with iOS5, it crash. Could someone explain me how all this stuff works? How can I use IOS6 functionalities that don't make the app crash when running in a previous version?

— asked 8 months ago by Xurde Appio
1 Comment
  • I've tried to change the OTHER_LDFLAGS param in the module.xcconfig:

    OTHER_LDFLAGS[sdk=iphoneos6*]=$(inherited) -framework Twitter -framework Social
    OTHER_LDFLAGS[sdk=iphonesimulator6*]=$(inherited) -framework Twitter -framework Social
    OTHER_LDFLAGS[sdk=iphoneos5*]=$(inherited) -framework Twitter
    OTHER_LDFLAGS[sdk=iphonesimulator5*]=$(inherited) -framework Twitter
    It does make sense, loading the frameworks just when they are available. But still does not work. Any idea?

    — commented 8 months ago by Xurde Appio

2 Answers

Accepted Answer

Tim from Appcelerator helped me with this

OTHER_LDFLAGS[sdk=iphoneos6*]=$(inherited) -weak_framework Social
OTHER_LDFLAGS[sdk=iphonesimulator6*]=$(inherited) -weak_framework Social
So the secret is -weak_framework

— answered 8 months ago by Dan Tamas
answer permalink
1 Comment
  • That was exactly what I need! This should be indicated in the module.xcconfig file...

    Thanks for sharing the secret , Dan :)

    — commented 8 months ago by Xurde Appio

This sounds like an object-c questsion... Stackoverflow is your friend

http://stackoverflow.com/questions/7331811/conditional-compilation-check-for-framework-before-importing

— answered 8 months ago by Aaron Saunders
answer permalink
3 Comments
  • Thanks Aaron,

    but I'm not completely sure that this is not a Appcelerator related question. Tell if I'm wrong:

    When you make a custom module, you compile it in your computer with (in my case) the iOS6 SDK. So, the conditional compilation it's applied in That moment (the compilation). Then it's not useful to detect the iOS version of the "client" device. That's why I think is an Appcelerator question, related to how to make the modules (of course so related with objective-c, too).

    I've already said that I was confuse about all this versions stuff, tell me if I'm wrong, I need some light :)

    — commented 8 months ago by Xurde Appio

  • sorry, I misunderstood you question, you are right.

    but still you need to detect the IOS version at runtime and properly branch inside of your module, which is still and objective-c question.

    UIDevice *myDevice = [UIDevice currentDevice];
    myDevice.systemVersion

    — commented 8 months ago by Aaron Saunders

  • It doesn't make sense to branch inside the module since the app crashes when the module is already loaded.

    What I need is to configure the module so when it is requested in a older iOS version it doesn't crash. I wonder if it's an Appcelerator or a Xcode / Objective-C question.

    — commented 8 months ago by Xurde Appio

Your Answer

Think you can help? Login to answer this question!