Sooner or later you will face with changing back button title in navigation bar. This may seem simple. But after few hours trying to change this damn text, you will change your mind. I have no idea why this is designed this way, but answer for question “How can I change back button text in current view controller?” is – you cannot. So how to do it without overriding whole navigation bar? All you have to do is change title of backBarButtonItem in PREVIOUS view controller. But there is another catch – you can’t just do :

self.navigationItem.backBarButtonItem.title = @"" 

becouse this won’t work. Instead of this, you need to:

UIBarButtonItem* backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backBarButtonItem;

And keep in mind – this has to be done in PREVIOUS controller, not the one you need to change your back button text. The alternative is to give up on native back button and create your own with:

UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"My back button" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.hidesBackButton = YES;
self.navigationItem.leftBarButtonItem = backButton;

This can seem trivial, but I saw lot of people complaining about not working tint color when using UIImage. Here is the proper way:

UIImageView *imageView = [[UIImageView alloc] init];
UIImage *image = [UIImage imageNamed:@"my_image"];
imageView.image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[imageView setTintColor:[UIColor redColor]];

The point is – “imageWithRenderingMode” method just returns new image with rendering mode set, it does not changes anything in image object itself.

Sometimes, especially if you are using custom plugins to import stock data, you may find products with some stock value (greater then 0) but with stock flag set to “out of stock”. How to find them? Using WP_Query of course:

Notice ‘post_type’ => ‘product_variation’ – if you are not using variations, just change it to ‘product’.

This can be really frustrating, you wanted your woocommerce shop running multilingual, but from cart page “Checkout” button leads to default language version? Solution is very simple, but not elegant – so far did not found another solution. First step is to create all woocommerce pages in every language you need, this is very simple but can take some time. Then, in your child theme (remember not to make any modifications to theme you are using!), in functions.php add such code:

All those functions are using same pll_get_post from Polylang plugin, to translate your default page ID you set in Woocommerce/Settings/Checkout/Checkout Pages to their translated version. Hope you will find it useful.

Well, the easiest way is to use

but if you don’t want to update all bundles and waste an hour of your time, you can use:

where <app> is placeholder for you app dir, like “app/frontend” or “app/backend”
in case you don’t have build_bootstrap.php on path above (it works for Symfony 2.7.x) just search for it inside vendor\sensio\distribution-bundle\Sensio\Bundle\DistributionBundle

Since this information is not easy to find, I want to share it with you. Valid WSSE security header should look like this:

this way you can execute request requiring this header.

If you are new to iOS programming this may take you a while to found out. But I’m here to help so will give you ready to use solution. So you have two (or more) view controllers (UIViewController) and one of them should show list of items, second one details of selected item? Well, solution depends on the way you are doing transitions betweeen controllers.

Continue reading

This can be frustrating when you are new to wordpres and/or woocommerce. You just created your first product, and got 404 when trying to see it. Fortunately solution is quite simple. In backend panel go to “Settings”, then “Permalinks”. In “Common settings” section make sure “Post Name” is selected, if not, choose it – it will look like “http://newbl.blastar.biz/sample-post/”. Then look below, in “Product permalink base” section choose “Shop base” – it will look like “http://newbl.blastar.biz/shop/sample-product/”. Click “Save CHanges” and below you should see new box with .htaccess settings like:

Just copy it and paste to your .htaccess. All links should work now!

If you just started playing with CloudKit, probably you will see that error trying to implement custom synchronization. Why need custom synchronization? Because receiving push message each time something changed in your cloud will be annoying. So probably you started with:

and this is a place where you will see such error. Why this happens? Becouse you cannot fetch changed records for default zone. This applies both private and public cloud. So what to do? You need to create new zone before you will save anything to database:

After refreshing your cloud dashboard you will see your zone in “Private data” section. Now you can change zoneId to:

Of course you can use whatever name you want, this will also allow you to logically group records. Now in fetchRecordChangesCompletionBlock you should see:

And the second info means there is no error, and in first you have your CKServerChangeToken you need to save somewhere for next call.

Recently I had an NSDate object which had to be convered to unix timestamp and added to NSDictionary. But, what a surprise – I can’t add anything which is not object, and┬átime_t is C element. So what to do? Solution as usual is very simple:

As result of this snipped, you will have NSNumber object in your dictionary instead of NSDate