We have recently developed a working application for an Android device using Eclipse and all the other Ultralite stuff. Pretty easy to get going and works fairly nicely.

No we are ramming our heads against the wall trying to get the Iphone version up and running. We are using Xcode 4 (which is all you can download now) but the Iphone tutorial appears to have been written for Xcode 3. There are massive changes to IDE and trying to follow the tutorial is frustrating to say the least. I'll bet the tutorial is simple and straightforward if one were to have Xcode 3 installed.

In any event, has anyone ever successfully written a Sync app using Xcode 4 and Ultralite? I would love to get the simple tutorial working. Things like GCC_PREPROCESSOR_DEFINITIONS are hard to find in Xcode 4. Also should we be using the Apple compiler or the GCC 4.2 ? If someone could shed some light it would be greatly appreciated

asked 29 Nov '11, 09:10

Codecranker's gravatar image

accept rate: 0%

(There are significant changes in Xcode 4. However, I've found that Apple's stuff is generally well thought out, even if it has a bit of a learning curve. An initial investment in learning how they do things should be well paid back later. Trying to force other systems' paradigms won't make you happy :)

Everything should work fine with Xcode 4 given an adjustment or two. Let's go at your specific problems until everything works...

As Bill mentioned, there's a change required to make the UltraLite runtime library build. (This has already been fixed here, but the EBF isn't posted yet.) Here's the description for that change:

The UltraLite runtime library for iPhone fails to build with recent Xcode/SDKs (Xcode 4.2 with iOS 5.0 SDK, for example) because gcc-4.2 is no longer shipped (the command is not found while trying to run build.sh). This problem can be worked-around by creating a symlink for gcc-4.2 -> gcc in the /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin and similar Simulator directories, or by modifying the makefile or build.sh used by UltraLite.

I can give you specific details about how to do this. The best alternative is probably to edit build.sh and add 'GCCSUF=' (no quotes) to the make command line (after XCODE=$XCODE, around line 88).

You should not have to do anything with GCC_PREPROCESSOR_DEFINITIONS, or anything like that. You will have to add libulrt.a to your project, and add SQLAnywhere/sdk/include to the include paths. UltraLite also relies on the CFNetwork and Security frameworks for synchronization.

By 'Apple compiler' do you mean LLVM? llvm-gcc will work fine. (That is, the LLVM code generator using the GCC front-end.) We have not experimented much with the clang front-end here, but you should be able to use that for compiling your app code.

Additional pointers:

  1. The sample code shows how to initially copy your database file to the app's Documents directory. In addition, as of iOS 5.0.1, you should set the "do not backup" attribute on this file (see Technical Q&A QA1719), and you should also specify the temp_dir connection parameter with the path to the app's tmp directory, so UltraLite's temporary file is not placed in the Documents directory. (By default, the temp file goes beside the database file.)
  2. You should synchronize on a separate thread. Achieve this using the NSOperationQueue and NSOperation objects. (They are very cool, and handle the threading for you in an optimal way.)
permanent link

answered 29 Nov '11, 12:09

Tim%20McClements's gravatar image

Tim McClements
accept rate: 34%

Tim - Wow! Thanks for the quick and knowledgable response. Much of what you outlined has been done. Here is where we are at:

1) The Ultralite runtime library build worked without any modifications. We have the file libulrt.a and it is added to the project

2) We added the include directory to the include path

3) Both the CFNetwork and Security Frameworks have been added

4) We have it set to use the Apple LLVM compiler 3.0 - We can change it to use the LLVM GCC 4.2

Using the Apple LLVM compiler 3.0 we see a bunch of errors in the Ultralite .h files. For instance in ulprotos.h we get errors of the sort:

Parse Issue Must use 'enum' tag to refer to type 'ul_database_propery_id'

In ulglobals.h we see: Semantic Issue Type specifier missing, defaults .....

I think we may be close but there is a compiler option that is off.

(29 Nov '11, 14:33) Codecranker
Replies hidden

@Codecranker: I have felt free to change your posting into a comment to Tim's answer as it seems more of a further question...

You can directly add a comment with the help of the "add new comment" button right below each question/answer.

(29 Nov '11, 15:24) Volker Barth

We will look into making the headers build clean.

For now I guess you can ignore the warnings or use the GCC front-end.

(29 Nov '11, 16:01) Tim McClements

Oh - I forgot to mention that you must compile (at least the modules calling UltraLite) as "Objective-C++" rather than "Objective-C". Do this either by creating modules with a .mm extension (instead of .m), or change the build setting "Compile Sources As" to "Objective-C++".

(01 Dec '11, 10:13) Tim McClements

I'm not sure if all developer licenses provide the same offerings, but I'm still able to access a Xcode 3.2.6 download with iOS 4.3 SDK. Once logged into the iOS developer center, there is a link for Xcode 3.

With that said, we are working on our Xcode 4.2 support and will provide in an EBF when it is ready (no ETA at this point). One of the changes includes updating the UltraLite runtime build script to use /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc for building. For my Xcode 4.2 this is a link to llvm-gcc-4.2.

An update for the tutorial was not planned as part of the work. I'm not sure when someone will be able to take a look at the tutorial, but I will add it to the list.

permanent link

answered 29 Nov '11, 09:59

Bill%20Frier's gravatar image

Bill Frier
accept rate: 41%

Thanks for the info Bill. The problem is we went out and bought a brand new MacBook Pro to develop an iPhone application against our version 12 Sybase ASA DB. The latest offerings from Apple come pre-installed with OS X Lion 10.7.2. From what I've read there is no chance of getting the old Xcode 3 up and running on the Lion platform. You need to partition your drive (something I'de rather not do) and install OS X Leopard 10.6 so that you can dual boot into the old OS.

I am going to give this a shot and see if it works but I'm surprised at how cumbersome it is to get a synchronized app going using Ultralite and the IOS architecture. Much of this has to do with the Xcode programming environment. While Apple has created something that is very easy for the end user to use, the recommended development environment of Xcode (at least version 4) is the most convoluted mess I have ever worked with. Give me back CodeWarrior for the love of Mike!!!!!!


(29 Nov '11, 10:24) Codecranker
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 29 Nov '11, 09:10

question was seen: 3,403 times

last updated: 01 Dec '11, 10:13