Como acessar a estrutura vinculada fraca no iOS?

Eu quero usar a estrutura do Twitter para iOS 5, mas conseguir executar meu aplicativo no sistema operacional mais antig

Adicionei uma estrutura referenciada fraca (ou seja, defina o sinalizador "opcional") nas configurações de destino do Xcode 4.2. O SDK base é o iOS 5, a implantação do iOS O destino é o iOS 3.2.

Em seguida, tento usar a estrutura do Twitter:

#import <Twitter/Twitter.h>
...
    Class twClass = NSClassFromString(@"TWTweetComposeViewController");
    if (!twClass) // Framework not available, older iOS
    {
        [self shareWithTwitterPriorIOS5];
        return;
    }

    if ([TWTweetComposeViewController canSendTweet]) // Check if twitter is setup and reachable
    {
        TWTweetComposeViewController* twc = [[TWTweetComposeViewController alloc] init];
//        [twc addURL:[NSURL URLWithString:@"http://mail.ru"]];
//        [twc addImage:[UIImage imageNamed:@"Some image.png"]]
        [twc setInitialText:textToShare];
        [viewController presentViewController:twc animated:YES completion:^{
            // Optional
        }];
        [twc release];
        // Assume twc is ARC released or call [twc release];
    }
    else
    {

    // Twitter account not configured, inform the user
}

Corre bem no simulador iOS 5. Assim que tento usar o simulador ou um dispositivo real com a versão mais antiga do sistema operacional, recebo o arquivo "Twitter / Twitter.h" de erro não encontrado (em tempo de compilação). Se eu remover a diretiva "#import", recebo alguns erros da classe TWTweetComposeViewController não encontrada.

Se eu comentar todo o código relacionado ao twitter, recebo o erro do vinculador: "ld: framework not found Twitter". O comando Ld causou um erro:

Ld /Users/mikhailkeskinov/Library/Developer/Xcode/DerivedData/Dictionary-eiyrziajmltuglfzgtnjxffkojwi/Build/Products/Debug-iphoneos/Dictionary.app/Dictionary normal armv6
    cd /Developer/WorkShop/XDictionary/trunk
    setenv IPHONEOS_DEPLOYMENT_TARGET 3.2
    setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk -L/Users/mikhailkeskinov/Library/Developer/Xcode/DerivedData/Dictionary-eiyrziajmltuglfzgtnjxffkojwi/Build/Products/Debug-iphoneos "-L/Developer/WorkShop/XDictionary/trunk/Dictionary/Twitter+OAuth/Libraries & Headers" -F/Users/mikhailkeskinov/Library/Developer/Xcode/DerivedData/Dictionary-eiyrziajmltuglfzgtnjxffkojwi/Build/Products/Debug-iphoneos -filelist /Users/mikhailkeskinov/Library/Developer/Xcode/DerivedData/Dictionary-eiyrziajmltuglfzgtnjxffkojwi/Build/Intermediates/Dictionary.build/Debug-iphoneos/Dictionary.build/Objects-normal/armv6/Dictionary.LinkFileList -dead_strip -miphoneos-version-min=3.2 -lxml2 -framework AVFoundation -framework UIKit -framework Foundation -framework CoreGraphics -lOAuth -weak_framework Twitter -o /Users/mikhailkeskinov/Library/Developer/Xcode/DerivedData/Dictionary-eiyrziajmltuglfzgtnjxffkojwi/Build/Products/Debug-iphoneos/Dictionary.app/Dictionary

O que há de errado aqui?

questionAnswers(4)

yourAnswerToTheQuestion