Showing posts with label iPhone. Show all posts
Showing posts with label iPhone. Show all posts

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, 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.

Wednesday, August 19, 2009

Finding iPhone Application's memory leaks

I found these useful guides by Googling.

1. Finding iPhone Memory Leaks: A “Leaks” Tool Tutorial: This explains with an iPhone device, but I am also sure we can use this tool, "Instruments" with an iPhone simulator. We can do it by choosing "iPhone Simulator" instead of "iPhone" and your own application by "Attach to process" drop down menu.

2. Memory Usage Performance Guide by Apple

Sunday, July 12, 2009

Starting with Objective-C for iPhone Apps

Recently, I need to start iPhone App programming in the project I am working.

Here are some useful references for beginners.

[Books]
1) Dave Mark and Jeff LaMarche, "Beginning iPhong Development", Apress, 2009.
2) Erica Sadun, "The iPhone Developer's Cookbook", Addison-Wesley, 2008.
3) "Learn Objective-C on the Mac", 2009.

[e-Books]
1) Bert Altenberg, Alex Clarke and Philippe Mougin, "Becom an Xcoder", 2008.
2) "Learn Objective-C 2.0 Language"

[Webpages]
1) Apple's iPhone Dev Center
2) Stanford University, CS 193P "iPhone Application Programming"
3) CocoaLab
4) Jeff LaMarche's iPhone Programming Blog