Tag Archives: error

“Real” URL encoding in iOS

Sometimes if you wish to encode a whole URL including /,&,: , [NSString stringByAddingPercentEscapes:] fails, to solve this issue, use CFURLCreateStringByAddingPercentEscapes

+ (NSString*)urlEncode: (NSString*) url {
    NSString* encoded = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)url, NULL, (CFStringRef)@"!*'();:@&=+$,/?%#[]",kCFStringEncodingUTF8);
    return [encoded autorelease];
}

Source

Android 3.x Action Bar customization

The ActionBar UI component has been introduced in Android 3.0 and above, and it seems to become the standard way to use tabs and context/action menus in Android applications.
You may also customize the ActionBar associated to your application in different ways through this great tutorial, however you might run into errors when you wish to override Tab item styles, to resolve this issue,
check this blog for a very straightforward solution. (due to private API issues)

Error adding EKEvent on iOS 5

If you try to add an EKEvent with startDate equals to endDate to EKEventStore on iOS5, it will throw an error like “No end date has been set”.
To get rid of this problem, you should add a second to endDate property, something like:

if ([event.endDate isEqualToDate:event.startDate]) {
    event.endDate = [event.startDate dateByAddingTimeInterval:1.0]; // add one second
}

Source: stack overflow