Thursday, August 26, 2010

Wednesday, May 5, 2010

Sharing custom data between two iPhone applications

In my iPhone application work, recently one issue came up. It is separating an iPhone application that I am developing into two applications while sharing custom data (i.e., images and text files) between two applications. So, I googled several forums with this issue. Here is my findings.

1) Using a server as a storage
2) Using a URL scheme
3) Using the pasteborad (UIPasteboard)
3) Using an "Address book" area

None of these was appropriate for my project where I need to share several images (1600x1200) and text files on a device without connection to a server. So, at this moment, I conclude that there is no way to share custom data between two iPhone applications.

[Reference 1] [Reference 2] [Reference 3] [Reference 4]

Thursday, April 29, 2010

Code Sign Error after reinstalling provisioning profile

Sometimes Xcode project file easily gets messed up. For example, when I try to rebuild my application that worked well with my previous provisioning file yesterday, however I reinstall my provisioning file today. In this case, following error message can be show up;

"Code Sign Error: Provisioning Profile (long string) can't be found."

Here is an easy solution.

1) Open the project file in a text editor:
The .xcodeproj file is actually not a file but a directory, like an application bundle. So, you can right click it in Finder to open. Then, select "package contents". Now, you will see several files. The actual project file is "project.pbxproj". Open it in a text editor.

2) Search provisioning profile setting and manually erase the lines. Save the project file:
They will look like these;
PROVISIONING_PROFILE = "xxxxxx.....xxxxx";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "xxxxxx.....xxxxx";

3) Reopen the project in Xcode and go to the settings to reselect your new provisioning profile.

Thursday, April 22, 2010

Monday, April 19, 2010

Wednesday, April 7, 2010

Using 3D models on iPhone

iPhone SDK mesh COLLADA import

OSG new release supporting OpenGL ES

OSG on iPhone
OSG for iPhone support isn't still released (by Robert Osfield, Mar 1st 2010). But, we can try to use above changes by Thomas Holgarth.

Wednesday, February 24, 2010

Public vs. Private vs. Protected

Public members can be accessed by any function in the program.

Private members can only be accessed by other functions within the class.

Protected members is accessible to members of classes that inherit from the class in addition to the class itself and any friends

Overloading vs. Overriding

Overloading is when you define two methods with the same name, in the same class, distinguished by their parameters.
-> Overloading is resolved at compile time.

Overriding is when you redefine a method that has already been defined in a parent class (using the exact same parameters).
-> Overriding is resolved at runtime (based on the type of the implicit first parameter).

Thursday, February 18, 2010

Google developing a translator

Wow! It will be very useful if it can really instantly translate during phone calls.

Google developing a translator for smartphones

Wednesday, February 17, 2010

OpenGL Tutorials

1. Opengl Tutorial

2. OpenGL Vertex Buffer Object (VBO): Simple Tutorial

C++ Static Functions

C++ Static Functions

Static member functions have a class scope and they do not have access to the 'this' pointer of the class. When a member is declared as static, a static member of class, it has only one data for the entire class even though there are many objects created forthe class. The main usage of static function is when the programmer wants to have a function which is accessible even when the class is not instantiated.

Wednesday, January 20, 2010

Universal C/C++ Static Library for iPhone simulator and device by GCC compiling

This shows how to create universal static library to use c/c++ code for iPhone applications. Here, my cpp code is MathFuncsLib.cpp and MathFuncsLib.h.

I created following script file and run it to get "libMathFuncsLib-fat.a".


#!/bin/bash

/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk -mmacosx-version-min=10.5 -D__IPHONE_OS_VERSION_MIN_REQUIRED=30000 -arch i386 -c -o MathFuncsLib_i386.o MathFuncsLib.cpp
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk -miphoneos-version-min=3.0 -arch armv6 -c -o MathFuncsLib_armv6.o MathFuncsLib.cpp

/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar rc MathFuncsLib_i386.a MathFuncsLib_i386.o
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar rc MathFuncsLib_armv6.a MathFuncsLib_armv6.o

/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ranlib MathFuncsLib_i386.a
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib MathFuncsLib_armv6.a

lipo MathFuncsLib_i386.a MathFuncsLib_armv6.a -create -output libMathFuncsLib-fat.a

Universal C/C++ Static Library for iPhone simulator and device using Xcode

In my previous post, I googled many articles to create universal static library by using shell script. However, here is a simple and easy way to create universal static library that can be used for both iPhone Simulator and device.

How to create universal C/C++ static library using Xcode
1. Create a new project using Xcode: iPhone OS->Application->OpenGL ES Application using Xcode (e.g., MathFuncsLib)
2. Delete all files from Classes
3. Delete "main.m" from Other Sources
4. Delete the current target "MathFuncsLib"
5. Create new static library target "MathFuncsLib"
6. Add your header (e.g., MathFuncsLib.h) and source (e.g., MathFuncsLib.cpp) files for MathFuncsLib into in Classes
7. Select active SDK: Simulator - your SDK version and Build (library file for x86 architecture)
8. Select active SDK: Device - your SDK version and Build (library file for arm architecture)
9. Find library files for each architecture under a build folder and change their file name appropriately. For example "MathFuncsLib-x86.a" and "MathFuncsLib-arm.a"
10. Copy them into any same folder
11. Create universal static library by running "lipo MathFuncsLib-x86.a MathFuncsLib-arm.a -create -output libMathFuncsLib-fat.a" in Terminal

How to use universal C/C++ static library in your iPhone application
1. Create your iPhone application
2. Open Info for Target, and on Build tab, add your library name for Linking->Other Linker Flags (you should use this format: -l[your library name]. In my case, -lMathFuncsLib-fat)
3. If you create separate folders for library such as "Include" for header files and "Lib" for library file, add them for Search Paths->Header Search Paths and Library Search Paths on the Build tab
4. Import header file for library in your application (e.g., #import "MathFuncsLib/MathFuncsLib.h")
5. Build and Go application
6. If you want to look at your application on iPhone device, you also need to follow the instruction to install your application on device by using "Apple Developer Program"

Thursday, January 14, 2010

How to copy iPhone Application Data to Mac computer

1) Navigate to the app on your phone via the XCode Organizer.

2) Click the triangle on the left of your app's name to show the "Application Data" field.

3) Press the down arrow on the right side of that to download it.

4) Save the application data into your local folder.
--> "Document", "Library", and "tmp" folders will be saved.