Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I integrate the Picasa API into my iPhone application?

Tags:

iphone

picasa

I have tried to integrate the Picasa API on iphone, compiles fine, but I am seeing the following error in launch.

dyld: Library not loaded: @loader_path/../Frameworks/GData.framework/Versions/A/GData Referenced from: /Users/jacksu/Library/Application Support/iPhone Simulator/User/Applications/9A7E3F54-022F-4771-BD6A-E458F5545144/PicasaTest.app/PicasaTest Reason: image not found

I am not sure what could be the problem.

I imported the GDataFramework from Source/build/Debug/GData.framework. I have built the project under Source directory.

like image 308
BlueDolphin Avatar asked Mar 02 '23 05:03

BlueDolphin


1 Answers

IPhone does not allow loading dynamic libraries. The external library/framework you are using must be build as a static library and compiled into your app during build time.

In order to make that happen first you need to create a static library version of GDATA:

  • Add a new target to the GData project (say GDataIPhoneLibrary)

    • You do this by right-clicking Target and selecting "Add New Target". In the Dialog select the static library template from the IPhoneOS - Cocoa Touch section.
  • Then you need to drag the source .m files to the Compile Sources section of the target. (Make sure not to drag the .h files, otherwise you will get warnings.) Also if you are just building for the Picasa then the file under Command and Photos groups should be sufficient. Also do not add the unit tests and the test tool groups.

  • Next go to the Frameworks and Libraries group under the project and add the Foundation framework which is the necessary framework for Cocoa Touch. When you are adding this make sure to only check your newly created target for this to be used. (You don't want to mess up the Mac version of GData)

  • Now under the Targets, select the GDataIPhoneLibrary you created and click on the (i) button (or just double click it)

  • Under the Build tab search for "header" and once you locate the "Header Search Paths" add the following (for libxml2) as the header path

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk/usr/include/libxml2

  • Now you close the dialog.

  • Select your Active Target to be GDataIPhoneLibrary

  • Set your ActiveSDK to Project-> SetActiveSDK -> Simulator - IPhone OS 2.1

  • Now you are ready to go -> just hit build and you will have the default libGDataIPhoneLibrary.a file.

Now you can add this static library to your IPhone application:

  • Go to your own application project and select the target (you probably have one) and double click it to open the dialog.

  • In the Build tab search for "library" and once you find "Library Search Paths" add the path to that library that you just built in the previous step.

  • Then add "-lGDataIPhoneLibrary" (omitting lib prefix and .a extension) to the "Other Linker Flags" option (which you can find by searching linker in the search box.

Now this should hopefully build. Hope this works for you.

Cheers, Kerem

like image 111
keremk Avatar answered Mar 16 '23 00:03

keremk