Search code examples
facebooklinkerfacebook-ios-sdk

Facebook-iOS-SDK: How to correct build framework and add it to project?


I develop an app for iPad.

At now, i test application on iPad-5.1 Simulator.

And for my unhappiness, application falls down.

1) I use FacebookSDK 3.0
2) Compile FacebookSDK into Framework FBiOSSDK
3) Add Framework FBiOSSDK to project
4) See log of Linker
5) Undefined symbols for architecture i386: "_sqlite3_open_v2" and many-many "_sqlite3_*" symbols.

Maybe i set wrong options to facebook-sdk project when build it to framework?

Can anybody help?

After search, i find a solution:

"Add to project libsqlite3.0.dylib"

But Linker said: "ignoring file /path/libsqlite3.dylib, missing required architecture i386 in file"

-- Main Problem --

After an hour, i've found out, that i link framework in wrong way.

Script create it in local directory (not in System/Library/Frameworks or Library/Frameworks).

After adding it, Framework Search Paths changes to not default value.

How to build framework in right way?

Thanks!


Solution

  • So, after a long time i make such things to make this FacebookSDK work:

    1)First, I delete build of FacebookSDK framework (rm -rf) and run script for building framework (build_framework.sh)

    2)After that, i add to project (project -> build phases -> link binary with libraries ) FacebookSDK.framework (from local directory, with button add other) and libsqlite3.0dylib and libsqlite3.dylib (just search it in search-field!)

    0) or 3)And After that i make this: find directory ~/Library/Developer/Xcode/DerivedData and delete EVERYTHING from this. (use command rm -rf dir_name/*)

    You can do it from step 3) that i also named step 0).

    Here i provide a script, which can help you

    #!/usr/bin/perl
    my $pathToCacheDirectory = qq(~/Library/Developer/Xcode/DerivedData/);
    
    sub TaskToDo{
        my ($refToArgv)=@_;
        die "can't work with too much parameters" unless(scalar(@$refToArgv)==1);
        my $what = shift @$refToArgv;
        my $time = 30; #wait 30 seconds in each iteration
        my $workRef = sub{
            print "i will delete: ";
            print qx(ls $pathToCacheDirectory);
        qx(rm -rf $pathToCacheDirectory);
        };
        #view help
        if ($what eq 'help'){
            print qx(perldoc -t $0);
        }
        #list directory 
        if ($what eq 'watch'){
        print qx(ls $pathToCacheDirectory);
        }
        #kill files instantly
        if ($what eq 'now'){
        print 'kill now'.qq(\n);
        $workRef->();
        print 'see result'.qq(\n);
        print qx(ls $pathToCacheDirectory);
        }
        #switch on watcher
        if ($what eq 'work'){
        for(;;){
            #in INF loop
            for my $s(0..4){
            #print "this is <<$_>>\n";
            print "time remaining: ".(5-$s)*$time." sec \n";
            sleep($time);
            }
            $workRef->();    
            sleep(10);
        }
        }
    } 
    
    TaskToDo(\@ARGV);
    
    
    
    __END__
    
    =head1 DESCRIPTION
    
    This script clear directory with cache from Xcode
    
        -- 'help'  will show this log
    
        -- 'work'  will run script as observer and killer
    
        -- 'watch' will show info about directory with cache
    
        -- 'now'   will kill all instantly
    
        Example: perl scriptName.pl help
    
    =cut