Tuesday, September 27, 2011

declaration of 'struct sockaddr_in' will not be visible outside of this function

Everybody and their mom has own modified Reachability code and none are compatible. Yet another fix to the "default" code, in case you see this kind of warning or error (no-warnings policy):
Reachability.h: error: declaration of 'struct sockaddr_in' will not be visible outside of this function [-Werror,3]
Fix is easy, just add this:
#import <netinet/in.h>
Hope Apple would pull together all "fixes" and update the Reachability master version for all of us.

Wednesday, September 21, 2011

How to Create Custom Background for UINavigationBar

Needed a custom background for UINavigationBar (pre-iOS5). First tried placing an UIImageView under "Black Translucent" UINavigationBar, but there were some problems:

Monday, September 19, 2011

Conversion specifies type 'unsigned int' but the argument has type 'unsigned long long'

Been quite busy with maintenance issues lately (close to release), no time to blog. So here's just a small tip until I get into more interesting new development tasks:
unsigned long long bodyLen =
  (unsigned long long) [self.bodyPrefix length] +
  // ALAsset defaultRepresentation size returns (long long)
  (unsigned long long) fileSize +
  (unsigned long long) [self.bodySuffix length];
DLog(@"Total data size to send: %llu", bodyLen);
[request setValue:[NSString stringWithFormat:@"%llu", bodyLength] forHTTPHeaderField:@"Content-Length"];
In case you missed, the "printf" parameter to display unsigned long long is %llu...

Wednesday, September 7, 2011

How to Do Dynamic Debug Logging in Released Application

Remote debugging can be really difficult, especially for released applications. You can't send ad hoc releases to everyone! Would love that, with service like TestFlight, but normal Apple iOS developer account can register only max 100 devices.

So what can you do?