Silent push notifications only delivered if device is charging and/or app is foreground

I have implemented silent push notifications but I have noticed some strange behaviour. The silent push notifications are handled via: – (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler The silent push messages only seem to be received if the device is charging (ie cable connected) and/or if my app is foreground. If I disconnect the device … Read more

Changing the userAgent of NSURLConnection

Hey I am using a NSURL Connection to receive data. [NSURLConnection sendSynchronousRequest: //create request from url [NSURLRequest requestWithURL: //create url from string [NSURL URLWithString:url] ] //request parameters returningResponse:nil error:nil ] Is it possible to change the user agent string? right now it is: AppName/AppVersion CFNetwork/459 Darwin/10.0.0.d3 Answer Obj-C: NSString* userAgent = @”My Cool User Agent”; … Read more

How to overwrite a file with NSFileManager when copying?

I’m using this method to copy a file: [fileManager copyItemAtPath:sourcePath toPath:targetPath error:&error]; I want to overwrite a file when it exists already. The default behavior of this method is to throw an exception/error “File Exists.” when the file exists. There’s no option to specify that it should overwrite. So what would be the safest way … Read more

How to insert utf-8 mb4 character(emoji in ios5) in mysql?

I am using mysql 5.5.10, and its character_sets are | character_set_client | utf8mb4 | | character_set_connection | utf8mb4 | | character_set_database | utf8mb4 | | character_set_filesystem | binary | | character_set_results | utf8mb4 | | character_set_server | utf8mb4 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | | collation_connection | utf8mb4_general_ci | | … Read more

NSURLConnection delegate methods are not called

I am trying to create a simple NSURLConnection to communicate with a server using a GET request. Connection works well, but delegates methods of NSURLConnection are never called.. Here is what am doing: NSString *post = [NSString stringWithFormat:@”key1=%@&key2=%@&key3=%f&key4=%@”, val1, val4, val3, val4]; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease] ; [request setURL:[NSURL URLWithString:[NSString stringWithFormat:@””, post]]]; … Read more

UICollectionView align logic missing in horizontal paging scrollview

I’ve got a UICollectionView, which works ok, until I start scrolling. Here some pics first: As you can see it’s great. As I start scrolling (paging enabled) the first one goes a bit offscreen: This is the problem. Originaly my view have 3 views and I want to scroll and show 3 views only. But … Read more