How to integrate Picasa API into iPhone app?

I tried to integrate the Picasa API on iphone, it compiles fine, but I see the following error on startup.

dyld: library not loaded: @loader_path /../ Frameworks / GData.framework / Versions / A / GData Links: / 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 GDataFramework from Source / build / Debug / GData.framework. I built the project in the Source folder.

+4
source share
3 answers

If you save GData.framework, you need to make sure that this is not a required infrastructure, but a weak structure. A weak environment means that the application will not require it at the first start and will only try to load it when the function calls the infrastructure, but in your case, since the library is statically compiled, the functions that are called will be allowed without the need to load the framework. (Note: C object messages are function calls at runtime ...)

To do this, try the following:

  • Double-click the application target (as before)

  • Check out the General tab this time.

  • Find GData.framework and change it from "Required" to "Weak"

You probably get compilation errors without adding a framework because the GDATA header files are not allowed. You could also put a link to the "header files" in the "Header Search Path". Instead, you will not need to add a framework.

Unrelated to the foregoing, I forgot one more thing before. Add -ObjC to your Other Linker Flag.

+3
source

IPhone does not allow loading dynamic libraries. The external library / structure that you use must be built as a static library and compiled into your application at build time.

For this to 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 box, select the static library template from the "IPhoneOS - Cocoa Touch" section.
  • Then you need to drag the source .m files to the Compilation Sources section of the target. (Make sure you do not drag .h files, otherwise you will get warnings.) Also, if you just create Picasa, then the file in the Command and Photos groups should be enough. Also do not add unit tests and test tool groups.

  • Next, go to the "Frames and Libraries" group within the project and add the Foundation framework, which is the necessary foundation for Cocoa Touch. When you add this, be sure to check the newly created goal for this. (You don't want to mess up the GD version for Mac)

  • Now, in the "Goals" section, select the created GDataIPhoneLibrary and click (i) (or just double-click it).

  • In the "Create" tab, find the "title", and as soon as you find the "Title Search Paths", add the following (for libxml2) as the title path

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

  • Now you close the dialog.

  • Choose your active target as GDataIPhoneLibrary

  • Install ActiveSDK in Project-> SetActiveSDK → Simulator - IPhone OS 2.1

  • Now you are ready to work -> just click build and you will have the libGDataIPhoneLibrary.a file by default.

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

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

  • On the "Assembly" tab, find the "library", and as soon as you find the "Library Search Paths", add the path to the library that you just created in the previous step.

  • Then add “-lGDataIPhoneLibrary” (excluding the lib prefix and the .a extension) to the “Other linker flags” option (which you can find by searching for the linker in the search box.

Now we hopefully will build. Hope this works for you.

Cheers, Kerem

+3
source

You cannot use dynamic libraries on the iPhone (of course, outside of Apple). All libraries must be statically linked.

+2
source

All Articles