Thursday, June 24, 2010

Another reason for "Undefined symbols referenced from"

Failed to add a static library into my iPhone application. Doing everything I've done earlier, searching for new tips on internet, recreating static library project dozens of times - and still:
Undefined symbols:
"_xmlDocSetRootElement", referenced from:
+[CXMLNode(CXMLNode_CreationExtensions) documentWithRootElement:] in libTouchXML.a
ld: symbol(s) not found
collect2: ld returned 1 exit status
Finally found out that even though my version of TouchXML links to dynamic libxml2, I need to link libxml2 with application, too! Expected that once would be enough. Now wondering whether it really will be linked twice.

Unexpected File Type 'wrapper.pb-project' in Frameworks & Libraries build phase

This is a XCode project dependency analysis warning and most likely means your project is missing something you expected to be there. There are similar warning notes for both build and link phases. More info at "Xcode's Plugin Interface".

warning: skipping file '/Users/jounimiettunen/svn_iphone/project/trunk/protobuf/ProtocolBuffers.xcodeproj' (unexpected file type 'wrapper.pb-project' in Frameworks & Libraries build phase)

It means that building or linking something failed, in this case ProtocolBuffers static library. Possible reasons are missing "Linked Libraries" and/or "Direct Dependencies" definitions or that building those failed.

Possible Fix: make sure your target (Info - General) has correct setup. If you're using Apple SDK 4.0 add -ObjC into "Other Linker Flags" and also -all_load to force loading of everything. Make sure you do this for both project and target. More info at Mac OS X Reference Library "Technical Q&A QA1490": Building Objective-C static libraries with categories.

Tuesday, June 22, 2010

Dereference of null pointer

XCode Build and Analyze command finds several "Deference of null pointer" warnings in some 3rd party sources.

Pointer with a possible value NULL is used like it always points to a valid memory area:
#include <stddef.h>
int *p = NULL;
*p;
Trying to use a null pointer *p will cause undefined behaviour, depending on compiler and operating system. Reading from it might return garbage values, writing to it might corrupt memory somewhere else. Null pointer errors have also been used to go around security systems. Protected mode OSes usually stop the application trying to do such things, causing application to crash instead of the OS.

How to fix: check pointer value before trying to use it. Code safe.

Thursday, June 17, 2010

Blogger and Google Analytics

Google Analytics for Blogger has been under private beta since April 2008, so don't hold your breath any more. What you can do is the "old fashined" way of Copy & Paste Google Analytics script at the end of your Blogger template.

Just remember: when you change blog template, you lose tracking right away. Immediately.

Apple AppStore status: Rejected

Some application submission status change emails go to "support" address only, not to iTunes Connect account holder.

There's excuse for everything, I can think of a dozen right away. Still find it rather strange that some emails go to account holder (review started) while other not (rejected). Makes one wonder many a things. Processes and people, for example. Theory and reality vs. achieved results. Investing time in right places.

Reason of Rejection: does not work with soon-to-be-released OS update.

Guess it's time to download beta SDK. Makes one wonder a few other things, too, like importance of backwards compatibility and legacy support. Seen different solutions for it, but kind of like Apple approach. Good for business, too.

Btw the content of "reject" email was just excellent. There was everything I could ask for and then some. Definitely time invested in right place!

Monday, June 14, 2010

Learn iPhone Programming by Example

Best way to learn is by example, at least for some people. Haven't checked these myself, but like the idea: 35 open source application.

ManiacDev.Com: 35 Open Source iPhone App Store Apps – Updated With 10 New Apps!

Looking at titles and descriptions, there are several I wish to check later. Might even use a few!

Thursday, June 10, 2010

Apple AppStore submit observations

Read docs a dozen times, but somehow missed these:
  • Keywords can be max 100 characters - including spaces and commas
  • Select "None" for first rating to get immediately 4+ rated
  • CFBundleShortVersionString in the Info.plist file must be a period-separated list of at most three positive integers. You cannot use e.g. "1.0.0 (1)" format, except in ad hoc releases
  • Large icon filename must end with .jpeg .jpg .tif .tiff .png. It's not about file format, but filename
  • Upload screenshots in reverse order, the first shall be last

Monday, June 7, 2010

How to Make Instruments Show Your Own Code

Debugging memory leaks with Instruments. Great tool, but would be more useful, if I could see there references to my code.

Turned out it's a known iPhone OS 3.0 defect, almost two years old! No idea why it hasn't been fixed by Apple. Maybe old SDKs are not supported on purpose, which does make some business sense.

How to fix: Go to your Xcode project, select project info, go to Build tab and search Base SDK. Change your project Base SDK to 3.1. I had there 3.0, which seems to be a known defect.
  • Build - Clean All Targets - select all - Clean
  • Build - Build and Analyze
  • Run - Run with Performance Tool - Leaks
  • Stop
  • Open popup item with application name - Launch Executable - Choose Executable
  • Browse to your Build directory and select your application
  • Record (the red Dot button)
It's not enough to start your application from Instruments, but you also have to choose the file. Stop and Record is not enough.