$ grep -r Tag: «ios»

-rw-r--r-- 439B Nov 25, 2025 · C146A84 · ~1 min

CompareShots 1.7

compareshots ios apps

CompareShots 1.7

This week I've released a new version of CompareShots. Nothing special, just updated the user interface to support Liquid Glass. Also, sharing the result image will not capture UI elements anymore.

Hard to believe, but this year CompareShots turns 10 years old. Time runs fast.

Download

[↵] open page compareshots-1-7.md
-rw-r--r-- 872B Aug 13, 2025 · 019E198 · ~1 min

CompareShots 1.6

compareshots ios apps

CompareShots 1.6

A new version of CompareShots has been released. It's a simple app I wrote years ago to compare two images.

The new version 1.6 has been rewritten in SwiftUI. And I've implemented a couple of ideas from app reviews that a user suggested.

What's new:

  • Choose your view: Easily switch between aspect fill and aspect fit with a new button.
  • Move your images: In aspect fill mode, use two fingers to reposition images for the perfect comparison.
  • Faster setup: Select up to two images at once for side-by-side comparison.
  • Expanded language support and improved accessibility.
  • Various bug fixes and performance enhancements for a faster, more reliable app.
  • Various bug fixes and performance improvements.

Download

[↵] open page compareshots-1-6.md
-rw-r--r-- 6.4K Nov 24, 2017 · 210FD78 · ~5 min

Animating the UISlider Thumb on Touch

swift ios полезное uislider

Animating the UISlider Thumb on Touch

I had a task to animate the slider in the app on touch by smoothly enlarging the thumb. Just like Apple does in the Apple Music and Podcasts player when you start scrubbing the playback position. I spent quite a lot of time looking for a way to do it with standard tools. I really did not want to write a completely custom slider; I wanted to use the system UISlider, and in the end I managed to do exactly that.

[↵] open page animatsiya-kasaniya-indikatora-v-uislider.md
-rw-r--r-- 651B Oct 24, 2017 · FBD7F97 · ~1 min

SMS Anticredit

sms антикредит ios приложения

SMS Antispam

I got tired of the SMS spam that periodically comes to me — offers for loans, mortgages, and so on. While watching one of the WWDC videos, I noticed that Apple had provided an API for filtering SMS messages. If your filter triggers, such messages arrive silently, without a sound or vibration, and go into a separate spam category in Messages.

Without much hesitation, I made this filter and uploaded it to the App Store. Hopefully it will be useful to someone besides me.

Download on the App Store

[↵] open page sms-antikredit.md
-rw-r--r-- 651B Aug 18, 2016 · AC73616 · ~1 min

CompareShots v1.2

compareshots ios приложения

CompareShots version 1.2 has been released.

I released it because one of the users emailed me asking to hide the logo and text after an image is selected, because otherwise, if the image is not full-screen, they stick out from behind it or show through. While I was at it, I decided to level up the app a bit more. At last, my subscription to various new libraries came in handy. Now you can draw on top of images. With different colors and brushes of different sizes. One evening, and this beauty was ready :)

Download

[↵] open page compareshots-v1-2.md
-rw-r--r-- 731B Apr 19, 2016 · 553E35F · ~1 min

CompareShots v1.1

compareshots ios приложения

CompareShots version 1.1 has been released.

What is new: transparency now changes simply by dragging your finger horizontally. One of the users actually asked for this feature in an email. It also makes the transparency change more smoothly.

Besides that, I completely rewrote the app in Swift. So now I have as many as one released project written in it :) But this is only the beginning.

What is surprising is that I submitted the App Store update yesterday, and in less than a day it had already passed Review and been released. I do not remember Apple ever approving an app that fast.

Download

[↵] open page compareshots-v1-1.md
-rw-r--r-- 2.2K Jul 10, 2015 · 02CABEA · ~2 min

Building an iOS Project from the Console with xcodebuild

ios xcodebuild шпаргалки

I'll leave myself a cheat sheet on how to make a bash script that builds your project into an ipa file.

In the iOS project source folder, create a folder, for example, scripts, and inside it create the file build.sh

mkdir scripts
touch build.sh
chmod +x build.sh

Put your provisioning profile into that folder. Say it is called arm1.ru.mobileprovision. After that, put this code inside build.sh:

#!/bin/bash

# go to the script directory
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${CURRENT_DIR}"

# use the same name that is selected in the project settings under Build Settings > Code Signing Identity
CODE_SIGN_IDENTITY="iPhone Distribution: Your Code Signing Identity"

# name of the provisioning profile stored here
PROVISION="$PWD/arm1.ru.mobileprovision"

# name of the scheme we are building
SCHEME="appScheme"
WORKSPACE="$PWD/../your-app.xcworkspace"

echo "Building..."

BUILDDIR="$PWD/build"
DSYMDIR="$PWD/dSYM"

if [ ! -d "$BUILDDIR" ]; then
    mkdir -p "$BUILDDIR"
fi

if [ ! -d "$DSYMDIR" ]; then
    mkdir -p "$DSYMDIR"
fi

# find the UUID in the provisioning profile
UUID=`grep UUID -A1 -a "${PROVISION}" | grep -io "[-A-Z0-9]\{36\}"`


xcodebuild     -workspace "${WORKSPACE}"     -scheme "${SCHEME}"     -sdk iphoneos     -configuration Release     CODE_SIGN_IDENTITY="${CODE_SIGN_IDENTITY}"     PROVISIONING_PROFILE="${UUID}"     OBJROOT=$BUILDDIR     SYMROOT=$BUILDDIR

if [ $? != 0 ]; then
    echo "Build failed"
    exit 1
fi

echo "Packaging..."

NOW=$(date +"%d_%m_%Y_%H_%M_%S")

xcrun -sdk iphoneos PackageApplication -v "${BUILDDIR}/Release-iphoneos/${SCHEME}.app" -o "$PWD/${SCHEME}_${NOW}.ipa"
if [ $? != 0 ]; then
    echo "Packaging failed"
    exit 2
fi

mv "${BUILDDIR}/Release-iphoneos/${SCHEME}.app.dSYM" "${DSYMDIR}/${SCHEME}_${NOW}.app.dSYM"

echo "Build succeeded."

Voilà, in the folder with the script you now have appScheme.ipa - the built project. The dSYM folder contains the dSYM files. You can add something else at the end of the script. In one of my projects, the end uploads the build to our homemade Testflight and sends the install link to everyone who needs it. Convenient: double-click the sh file and everything gets built and sent.

[↵] open page sborka-ios-proekta-iz-konsoli-cherez-xcodebuild.md
-rw-r--r-- 1.0K Jul 9, 2015 · E4EC750 · ~1 min

How to Disable the Swipe Back Gesture in iOS 8

objective-c ios шпаргалки

iOS has a system gesture - swipe from the left edge of the screen and you go back to the previous screen. It's cool and intuitive, and it annoys me when apps disable it, but sometimes you still have to do it. For example, because of an interface decision that conflicts with this swipe.

So for iOS 8, add this to the current UIViewController:

in YouViewController.h:

// add the gesture handling protocol
@interface YouViewController : UIViewController <UIGestureRecognizerDelegate>

in YouViewController.m:

- (void)viewDidLoad {
  [super viewDidLoad];

  self.navigationController.interactivePopGestureRecognizer.enabled = NO;
  self.navigationController.interactivePopGestureRecognizer.delegate = self;
}

#pragma mark - UIGestureRecognizerDelegate

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
  // disable the gesture if this is swipe back
  if ([gestureRecognizer isEqual:self.navigationController.interactivePopGestureRecognizer]) {
    return NO;
  } else {
    return YES;
  }
}
[↵] open page kak-otklyuchit-zhest-swipe-back-v-ios-8.md
-rw-r--r-- 976B May 25, 2015 · 656A140 · ~1 min

CompareShots

compareshots ios приложения

CompareShots

Released a new app - CompareShots.

While working, I had the thought that it would be nice to have some kind of tool for comparing the mockup and the actual result. I wrote this little tool in one evening. Then I spent a few more evenings making screenshots. Yeah, the screenshots took more time :)

The app lets you choose 2 images from the device library. For example, a designer's app or website mockup and a screenshot of what the developer built, and check whether it really matches pixel for pixel. While you keep your finger on the screen, the first image is shown. Take it away, and the second one appears. There is a transparency slider, so you can clearly see where things do not match. The mismatch result as an image can be shared, emailed, or sent to any other app that accepts images.

App for iPhone and iPad.

Download

[↵] open page compareshots.md
-rw-r--r-- 3.2K Apr 1, 2015 · 1031533 · ~3 min

iPodpiski: Final Results

айподписки ios приложения

iPodpiski

So, in February Yandex forcibly moved all Yandex.Subscriptions users to the Yandex.News service. Without warning, and the whole thing turned out pretty badly. The web version became unavailable. But the API kept working, and the Yandex folks only said that it would continue working. They kept quiet about deadlines and plans. First, new RSS entries stopped being pulled in and the API gave access only to old entries, and then they sent everyone emails saying that on March 31, 2015 they would shut down the API too. Which is what happened. So I removed the iPodpiski app from the App Store and want to sum up some results for myself and for the record.

I wrote the app in spring 2014 in about a week, coding in the evenings. It appeared in the App Store on April 17, 2014, which I happily wrote about on my site and in a post on Habr. The post got a +15 rating and brought some downloads and feature requests. The app fell 17 days short of its first birthday :)

Over that year there were:

iPodpiski Final Results

1321 downloads of the app and only 496 updates when I released new versions. Not much, but then this is not a mass-market app. RSS is generally considered a technology for robots and geeks. The overwhelming majority of users were from Russia. In 2nd and 3rd place were the US and Ukraine, tied. Record: 77 installs in one day.

iPodpiski Final Results

1431.42 rubles of revenue from in-app purchases. Initially the app was free, but with ads and a paid option to disable them. Of my 4 apps in the App Store, this is the worst result. On the other hand, getting some money for learning, gaining experience, and solving one of your own problems is not bad either :)

iPodpiski Final Results

Most of the time the app was in the Top 200 in its category (News) in Russia. The screenshot above shows the highest positions it managed to crawl to in the charts.

iPodpiski Final Results

Ratings were not great. I never asked people to rate the app anywhere, so ratings were left either by enthusiasts and friends, or by dissatisfied users. Unfortunately, I missed a very annoying bug. When the app launched in portrait mode, the «All Subscriptions» button simply did not appear. As a result, the user saw only the welcome screen and the paid «remove ads» button :) Sad and funny at the same time. I myself constantly used the app in landscape mode and simply did not notice this problem, but I got reviews like «only the ads work».

Most of the requested features I never managed to implement because of lack of time. When you spend the whole day doing web development, it is hard to switch to mobile in the evening, especially when you are tired after work.

The app shows ads from AdMob. Over the year there were only 71135 ad impressions, which brought in $23.87. In other words, the in-app purchase to disable ads brought in more money than the ads themselves :)

So those are the modest results.

[↵] open page itog-ajpodpisok.md
-rw-r--r-- 678B Feb 17, 2015 · 13F393C · ~1 min

iPodpiski and the Shutdown of Yandex.Subscriptions

айподписки ios приложения

Since Yandex shut down its Yandex.Subscriptions service and forcibly moved everyone to Yandex.News, I think this is the end for iPodpiski. Unless they make a public API for Yandex.News. If it is good enough for a port, I'll try to move iPodpiski to the new API. But there is no API yet. The Yandex.Subscriptions API itself still works for now, but they have stopped collecting new news from RSS feeds. The latest news I have there is from February 5-6. I have switched to Feedly myself. Thanks to everyone who used it :)

UPDATE: an email arrived saying that the subscriptions API will be shut down on March 31. Apparently I'll have to remove the app from the App Store too.

[↵] open page ajpodpiski-i-zakrytie-yandeks-podpisok.md
-rw-r--r-- 3.0K Aug 19, 2014 · B3B2675 · ~3 min

Escaping the sandbox in iOS

ios xcode jailbreak боль

A post born of pain. It just so happens that right now I am poking at someone else’s project that is designed to run on jailbroken iPhones. And not just run on them — it needs access outside the sandbox.

As everyone knows, all apps in iOS run inside a sandbox and cannot go outside it. All App Store apps are installed into /var/mobile/Applications/ (apps installed onto an iPhone from Xcode go there as well), where a separate folder with an unreadable name is created for each app. You cannot go outside that folder. Not for reading and certainly not for writing.

Escaping the sandbox in iOS

This, for example, is the folder of Google’s Ingress game.

Escaping the sandbox in iOS

And this is the iOS Calculator app, for example, living in /Applications.

If we want, for example, to read the phone’s SMS messages from inside an app, we need to read the file /var/mobile/Library/SMS/sms.db — it is a regular SQLite database with no encryption or protection. You can download it from a jailbroken phone and open it with any tool that knows how to open SQLite files, look at all SMS messages, and even hammer it with sql queries for search and other tasks.

Escaping the sandbox in iOS

Here, for example, is the file with all iPhone SMS messages.

So, there is no access to that file from the sandbox. And Jailbreak does not solve that. It gives full access to the file system, but only if you are working outside the sandbox.

For an app to work outside the sandbox, it has to be moved from /var/mobile/Applications/ to the /Applications directory. Then the app will live in the system apps folder, have access to the file system on a jailbroken device, not be removable from the phone by holding a finger on its icon, and so on.

And that is where the pain starts: Xcode simply cannot install the app there; it can install only into the sandbox. You can do it by hand — connect to the phone and move it with something like iFunBox — but that is a huge pain every single time. The worst part is that you lose the convenience of debugging. You cannot run the app on the device from Xcode and calmly watch the console to see what your app is printing and whether it is working.

No tweaks from Cydia that supposedly give apps file-system access even from inside the sandbox had any effect. At least not for me on iOS 7.1.2. They say that even if you run the app as root but still inside the sandbox, it still will not get permission to read system directories. Although it feels like this used to work before, but jailbreaks were different back then too.

That is the hell I am in. In the near future I am going to try some scripts I found online to automate moving the app around inside the iPhone after the build via SSH while also capturing syslog. I also want to write up what I have dug out inside the iPhone in terms of “where everything is stored”, but later, once this hell is over :)

[↵] open page vyhod-za-predely-pesochnitsy-v-ios.md
-rw-r--r-- 2.6K Jul 2, 2014 · 694B598 · ~2 min

Linode client for iPhone

linode ios приложения

I have been using Linode.com hosting services for several years now. That is where I keep my VPS with sites / projects and for various personal purposes.

They have an API, and as far as I understand, they built an iPhone client on top of it.

The client looks like it was just reskinned.

Linode client for iPhone Linode client for iPhone

[↵] open page klient-linode-dlya-iphone.md
-rw-r--r-- 7.2K May 22, 2014 · 6AB0DD9 · ~5 min

Writing a Yandex.Metrica Client for iPhone

objective-c ios айметрик

iMetrik

A copy of my article from Habr

[↵] open page pishem-klient-dlya-yandeks-metriki-dlya-iphone.md
-rw-r--r-- 471B Apr 22, 2014 · C3CA7C6 · ~1 min

iMetrik 1.1 Update

айметрик ios приложения

iMetrik 1.1 Update iMetrik 1.1 Update iMetrik 1.1 Update

Today the iMetrik update was released. The main additions are the Visitors tab with reports by gender, age, and geography, and the Goals tab, which contains all the same reports but for goals and with additional parameters such as goal achievement, conversion, and more.

Also fixed a couple of issues.

[↵] open page obnovlenie-ajmetrik-1-1.md
-rw-r--r-- 901B Apr 17, 2014 · 9BB67AD · ~1 min

iSubscriptions — Yandex.Subscriptions Client for iPad

айподписки ios приложения

iSubscriptions — Yandex.Subscriptions Client for iPad

I had wanted to write this app for a long time. Strangely enough, in the eight months since Yandex opened the API for Yandex.Subscriptions after Google Reader was shut down, not a single iOS client had appeared. And I wanted such an app for myself as well. I started reading news at home with a cup of tea, then continued on the road on my iPad — everything I had already read was marked as read, beautiful. And in general it is simply more convenient for me to read news on the iPad. Somehow the web version of Subscriptions does not work particularly fast.

In the app you can not only read news and share it on social networks or add it to Safari Reading List, but also manage subscriptions — add new feeds and remove the ones already added.

If there is no app, write it yourself :) The app is free.

[↵] open page ajpodpiski-klient-dlya-yandeks-podpisok-dlya-ipad.md
-rw-r--r-- 483B Apr 2, 2014 · 24FA631 · ~1 min

iMetrik — Yandex.Metrica Client for iPhone

ios айметрик приложения

iMetrik iMetrik

I released a mobile client for Yandex.Metrica for iPhone. The first version can do the following:

  • traffic summary (visits, page views, visitors);
  • daily traffic chart;
  • report on traffic sources to your site;
  • report on traffic from search engines;
  • report on traffic from other websites;
  • report on search phrases visitors used to find your site;
  • display the list of your counters.
[↵] open page imetrik-klient-dlya-yandeks-metriki-dlya-iphone.md
-rw-r--r-- 1.4K Mar 6, 2014 · 7E6BD4A · ~2 min

This Day 2.0

этот день ios приложения

This Day 2.0

I released an update for the This Day app. I redesigned it for iOS 7 (which is roughly the same as removing almost all styling altogether). In my opinion it became nicer and more concise.

I used the standard UIActivityViewController for sharing via Facebook, Twitter, and other built-in options such as email, sms/iMessage, etc., and I also added Vkontakte-iOS-SDK for sharing to VK instead of the homemade thing that had been there before. True, there are not really any visual differences for the user, and by the time I finally got around to polishing everything, VK had already released an official iOS SDK, but I did not want to dig into it just to replace something that was already working.

At the same time I got rid of the now unnecessary SBJson for working with JSON, because you can safely use the NSJSONSerialization already built into iOS. I decided to add Yandex.Metrica Mobile to the app to count users properly and see, for example, who uses which iOS version and on what device. For now I am just watching the numbers; it is informative.

This is how the little hobby project continues. I will think about what else to build into it, and then I will write the next app. For now — download/update:

Download

[↵] open page etot-den-2-0.md
-rw-r--r-- 1.7K Jul 9, 2013 · F9EB0EF · ~1 min

Detecting When the Map Stops in Google Maps SDK for iOS

objective-c ios шпаргалки

An addition to this post. There I mentioned among the problems that Google Maps only provides the event mapView: didChangeCameraPosition:, which fires at every tiny movement of the map, even while the finger is still on the screen. If you move your finger slowly across the map and some markers are supposed to appear via external HTTP requests, it manages to send 10-15 requests per second. That is of course unacceptable, especially on mobile internet.

But you can handle this yourself, more specifically with UIPanGestureRecognizer.

Code cheat sheet:

// где-то в коде проекта
panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mapDidChange:)];
[panRecognizer setMinimumNumberOfTouches:1];
[panRecognizer setMaximumNumberOfTouches:1];

// GoogleMapsView это гуглокарта, класс GMSMapView
GoogleMapsView.gestureRecognizers = @[panRecognizer];

//.. метод, реагирующий на отпускание касания
-(void)mapDidChange:(UIPanGestureRecognizer *)pan {
    if ( panRecognizer.state == UIGestureRecognizerStateBegan ) {
        // ничего не делать, но можно и что-нибудь делать
    }
    if ( panRecognizer.state == UIGestureRecognizerStateEnded ) {
        // палец отпущен, можно делать то, что нужно, например:
        [self sendMapRequest];
    }
}

That is it: you attach the gesture recognizer to the Google map. When the finger is released, you perform the required actions. Theoretically this can even replace mapView: didChangeCameraPosition: if needed.

[↵] open page otlavlivanie-ostanovki-karty-v-google-maps-sdk-dlya-ios.md
-rw-r--r-- 2.3K Jul 9, 2013 · 54430E4 · ~2 min

Replacing UIDevice uniqueIdentifier

objective-c ios шпаргалки

Since uniqueIdentifier is now deprecated (back from the iOS 5 days) and Apple no longer accepts apps that use this method (the latest Xcode, it seems, does not even build a project that uses this function).

I googled what to replace it with and assembled one solution from several different ones:

NSString *uuid = @"";

if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) {
    // This is will run if it is iOS6 or later
    uuid = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
} else {
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    id uuidId = [defaults objectForKey:@"deviceUuid"];
    if (uuidId)
        uuid = (NSString *)uuidId;
else { // Create universally unique identifier (object) CFUUIDRef uuidObject = CFUUIDCreate(kCFAllocatorDefault); // Get the string representation of CFUUID object. uuid = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuidObject); CFRelease(uuidObject); [defaults setObject:uuid forKey:@"deviceUuid"]; } }

Apple now suggests using the identifierForVendor method. This identifier will be unique for each device, but the same across all of your apps on that device. That is, if you install 2 apps from one vendor on the same phone, this id will be the same in both apps. It appeared in iOS 6 and, as far as I understood, on iOS 6 it changes if the app is deleted and installed again. In iOS 7, judging by what people write, it will already be tied to the MAC address and will always stay the same.

The identifierForVendor method had a bug in iOS 6.0: on devices updated over the air it returned a value full of zeros. In 6.0.1 and later that was fixed.

identifierForVendor appeared only in iOS 6, so if you support iOS 5 you need something else. This is where CFUUIDCreate comes in handy. An ID created with it will also change after the app is removed and installed again if you store it somewhere like NSUserDefaults, as in the code above. If you store it in KeyChain, you can avoid it changing after installation. Although how necessary that is is not very clear to me personally. But once generated, the identifier has to be stored somewhere, otherwise this code will generate a different one every time.

That is the cheat sheet.

[↵] open page zamena-uidevice-uniqueidentifier.md
-rw-r--r-- 6.7K May 28, 2013 · 9DF6E14 · ~5 min

Using Google Maps SDK for iOS

ios objective-c google maps шпаргалки

Using Google Maps SDK for iOS

In December, Google released an SDK for embedding its maps into iOS apps. Over the last few days I have been tinkering with it, trying to integrate it into my project. Here is a short description of how to embed it.

[↵] open page ispol-zovanie-google-maps-sdk-for-ios.md
-rw-r--r-- 1.9K Dec 18, 2012 · EDC0F30 · ~2 min

Escaping image URLs with Russian filenames in Objective-C

objective-c ios

Management at the office started uploading images with Russian filenames into news on the portal — things like Фото-Ресторана.jpg.

Images from news items are shown inside the app, so the app fetches them by these URLs.

The URL arrives in the app already percent-encoded, e.g.:


http://allcafe.ru/s/pic/news/!_2012/2012_12/%D0%A0%D0%B5%D1%81%D1%82%D0%BE%D1%80%D0%B0%D0%BD-Graf-in-%D0%A1%D0%B0%D0%BD%D0%BA%D1%82-%D0%9F%D0%B5%D1%82%D0%B5%D1%80%D0%B1%D1%83%D1%80%D0%B3-%D0%B7%D0%B8%D0%BC%D0%BD%D1%8F%D1%8F-%D1%82%D0%B5%D1%80%D1%80%D0%B0%D1%81%D0%B0.jpg

The app uses a class called AsynchronousUIImage that I found online about a year ago. It just loads the image asynchronously via NSURLConnection.

- (void)loadImageFromURL:(NSString *)anUrl {
    anUrl = [anUrl stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:anUrl] 
        cachePolicy:NSURLRequestReturnCacheDataElseLoad 
        timeoutInterval:30.0
    ];

    connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
}

The catch turned out to be in stringByAddingPercentEscapesUsingEncoding. Since the URLs come in already percent-encoded, it looks like double-encoding was happening and the image simply wouldn’t load. And if the NSURLConnectionDelegate method connection:didFailWithError: isn’t implemented, you get a crash — which is what hit me.

The funny conclusion: if you have URLs containing Cyrillic characters, you have to escape them either on the server before sending them to the client, or in the client. Doing it in both places — doesn’t work. Doing it nowhere — also doesn’t work :)

Luckily I fixed it on the server side without breaking anything and avoided shipping an emergency client update. By the way, on Android there is no such problem.

[↵] open page pro-ekranirovanie-url-ov-izobrazhenij-s-russkimi-imenami-v-objective-c.md
-rw-r--r-- 1.1K Dec 11, 2012 · 4AFEB6A · ~1 min

Optimising an iOS app for the iPhone 5 screen

шпаргалки ios objective-c iphone 5
  1. For the xib files of your View, set Size: Freeform. The interface will then stretch to the full height of the screen. If you need full control, you can set the view size for either the 3.5" or the 4" screen and switch programmatically.
    Optimising an iOS app for the iPhone 5 screen
  2. The most important thing — add a launch image for the 4" screen. Without it, the app for some reason thinks the screen is small. And yes, if you weren’t using a launch image at all before, looks like you’ll have to start now.
    Optimising an iOS app for the iPhone 5 screen

I haven’t tried this with Storyboard yet. And one more small handy trick — if you need to detect in code whether the screen is wide or regular, you can define this in prefix.pch:

#define IS_WIDESCREEN ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON ) 

and then check it in code:

if ( IS_WIDESCREEN == YES ) {
    // use the 4" interface
} else {
    // use the 3.5" interface
}
[↵] open page optimizatsiya-ios-prilozheniya-dlya-ekrana-iphone-5.md
-rw-r--r-- 1.2K Mar 27, 2012 · 6966626 · ~2 min

This Day for iPad 1.1

ios этот день

Этот день

Version 1.1 of This Day for iPad has been released. At first I wanted to add swipe navigation for events and fix a few small things, but somehow it dragged on. When I finally coded it, I had to reject the app from the App Store 2 or 3 times because I kept finding nasty bugs that made it crash or display incorrectly. By the time I had fixed everything critical, the new iPad had come out, so I added graphics for it right after that. And at the very end I discovered that sharing to VK requires a captcha, so I had to google it and implement its handling.

So in the end, what started as small changes turned into a pretty substantial changelog for such an app:

  • support for iPad with Retina display;
  • events can now be swiped with a finger;
  • when publishing an event to Facebook or VKontakte, the app now shows a notification that the publication succeeded;
  • when publishing events to Facebook or VKontakte, they are now posted in a more understandable form with the full date;
  • captcha handling for posting to VKontakte added;
  • fixed a bug that prevented long events from being published;
  • minor improvements and bug fixes.
[↵] open page etot-den-dlya-ipad-1-1.md
-rw-r--r-- 733B Mar 22, 2012 · 52877BF · ~1 min

AllCafe for iPhone 2.0

ios allcafe приложения

AllCafe для iPhone

AllCafe for iPhone 2.0 has been released.

What is new in version 2.0

  • New restaurant info layout;
  • viewing restaurant photos;
  • new restaurant news layout;
  • viewing photos attached to news items;
  • new restaurant review layout;
  • viewing photos in a review and all photos from all visitor reviews;
  • restaurant magazines added;
  • various fixes and additions.
[↵] open page allcafe-dlya-iphone-2-0.md
-rw-r--r-- 2.2K Mar 20, 2012 · E6D74F1 · ~2 min

How to detect a Retina Display on iPad/iPhone

ios objective-c ipad retina шпаргалки

Note! If you just need to figure out what kind of screen your iPad, iPhone, or iPod has, simply follow this link: https://arm1.ru/retina/

While trying to figure out how to detect the presence of a Retina display on a device in Objective-C, I had to do some googling. I found this solution and am writing it down here as a cheat sheet.

Get the screen bounds:

CGRect screenBounds = [[UIScreen mainScreen] bounds];

It returns the screen size, usually 320x480; even on iPhone 4, iPhone 4S, and iPod Touch it will still return 320x480 (apparently because old apps would otherwise crash). For iPad it returns 768x1024 — both on iPad/iPad 2 and on the new iPad with Retina Display.

Get the screen scale:

CGFloat screenScale = [[UIScreen mainScreen] scale];

It returns 1.0f for all non-Retina screens. It returns 2.0f for Retina screens. This applies to all iOS devices.

So, having screen dimensions characteristic of the form factor (phone/iPod or tablet) and knowing the scale, we can calculate the device’s actual screen size:

CGSize screenSize = CGSizeMake(screenBounds.size.width * screenScale, screenBounds.size.height * screenScale);

If you run code like this:

CGRect screenBounds = [[UIScreen mainScreen] bounds];
NSLog(@"%f x %f", screenBounds.size.width, screenBounds.size.height);
    
CGFloat screenScale = [[UIScreen mainScreen] scale];
NSLog(@"%f", screenScale);
    
CGSize screenSize = CGSizeMake(screenBounds.size.width * screenScale, screenBounds.size.height * screenScale);
NSLog(@"%f x %f", screenSize.width, screenSize.height);

then you will see all dimensions in the console. In this case, I ran it on the iPad Retina simulator:

Как определить Retina Display на iPad/iPhone

And then, by checking the dimensions/device type, you can substitute the required graphics at the required sizes. Profit.

P.S. As for images, you only need to create 2 files: for example, "image.png" and the same image at double size named "image@2x.png", and then use only the first one. For example:

[UIImage imageNamed:@"image.png"];

If the device has Retina, the app will automatically pick up the higher-resolution file (image@2x.png).

[↵] open page kak-opredelit-retina-display-na-ipad-iphone.md
-rw-r--r-- 2.4K Jan 13, 2012 · 78111A5 · ~2 min

A Useful Thing: Prefix.pch

ios objective-c precompiled headers

I discovered a useful thing in iOS development: the Prefix.pch file, a Precompiled Header.

From the description, Precompiled Headers are compiled, cached, and then automatically included into every file being compiled. So if there is some class that is needed everywhere or almost everywhere in a project, you can include that class inside the Prefix.pch file, which is created automatically in a new project, and it will be available everywhere. I really didn't like having to include the same class again and again in every View Controller when it was needed almost everywhere.

[↵] open page poleznaya-shtuka-prefix-pch.md
-rw-r--r-- 2.2K Dec 27, 2011 · 522B2DC · ~2 min

Boosting iPhone 4 volume

ios jailbreak iphone 4 полезное

Boosting iPhone 4 volume

I have a French iPhone 4. Apple is required to cap headphone volume on phones sold in France — apparently to look after the citizens’ ears. In the metro that cap leaves me short on volume, and besides, headphones vary — some play louder, some have different impedance and play quieter.

The cap can be bypassed. You need to jailbreak the phone, then access the file system and tweak a couple of plist files. There are plenty of options — installing a Terminal via Cydia, mounting the phone as a drive on your computer, etc. I prefer the second route — installed Phone Disk, it mounted the phone as a volume, and from there I just rummaged through the file system.

[↵] open page uvelichenie-gromkosti-iphone-4.md
-rw-r--r-- 551B Dec 21, 2011 · 13E5582 · ~1 min

AllCafe for iPhone 1.1.2

allcafe ios приложения

AllCafe for iPhone

Released a small AllCafe for iPhone update. The main changes are iPhone 3G support (i.e. support for the entire iOS 4 line) and image compression on the client side when adding reviews. Photos also get uploaded with the correct orientation now (portrait or landscape).

The pleasant surprise: the update was approved in just one day. Looks like reviewers are working at an accelerated pace right now — even iTunes Connect will be closed for the holidays from December 22 to December 29.

[↵] open page allcafe-dlya-iphone-1-1-2.md
-rw-r--r-- 836B Dec 5, 2011 · 2A8503A · ~1 min

Embedding the Facebook SDK in an iOS app

objective-c json ios шпаргалки полезное

A note to self. Instructions on where to download it and how to embed are in Facebook’s docs. Even though they updated the GitHub project recently (November 23 at the time of writing), they still ship an old version of the JSON framework bundled with it. And since my project already uses a newer version of that framework, the app wouldn’t compile.

Fix:

  1. after adding the SDK to the project, delete the JSON folder from the Facebook SDK;
  2. in FBRequest.m replace the line #import "JSON.h" with #import "SBJson.h";
  3. in the same file, replace
    SBJSON *jsonParser = [[SBJSON new] autorelease]
    with
    SBJsonParser *jsonParser = [[SBJsonParser new] autorelease]

Should work.

[↵] open page vstraivanie-facebook-sdk-v-ios-prilozhenie.md
-rw-r--r-- 1.4K Nov 14, 2011 · 22DBAAB · ~2 min

AllCafe app for iPhone

allcafe ios приложения

AllCafe for iPhone

We’ve finally finished the first version of AllCafe for iPhone — one we can actually show off.

How many times have you walked into a place only to find there are no free seats — or just realised that today you don’t fancy this place after all? It happens to me a lot. And the first thought is: where else can we sit / eat / have a drink nearby?

Our portal AllCafe.ru has a fairly large database of restaurants across Russia. Plus user reviews about them. We made an iPhone app — which, by the way, weighs only about 200 KB. With it you can see nearby venues on a map, or as a list with the approximate distance.

For each venue you can see brief info — address, phone number (which you can of course dial straight from the app), what kind of cuisine it serves, read news about the venue, and — important — read reviews and decide whether to go.

You can also leave a review yourself. Sitting happily (or unhappily) in a restaurant — open the app and add a review.

That’s only what’s in the app right now. The list of planned features is pretty long and there’s plenty of work ahead.

This is, in fact, my first iOS app. Congrats to me.

[↵] open page prilozhenie-allcafe-dlya-iphone.md
-rw-r--r-- 6.7K Oct 25, 2011 · E5735EF · ~4 min

Using UINavigationController together with UITabBarController

ios objective-c

Needed to use both UINavigationController and UITabBarController in the same project. Two ways to do it.

[↵] open page ispolzovanie-uinavigationcontroller-vmeste-s-uitabbarcontroller.md
-rw-r--r-- 4.8K Oct 13, 2011 · 9FD7A5C · ~4 min

Mac OS X Lion and iCloud

icloud облака apple mac os ios

Apple iCloud

Well, the new macOS with iCloud support is out, and iCloud itself has come out of beta.

[↵] open page mac-os-x-lion-i-icloud.md
-rw-r--r-- 5.1K Aug 23, 2011 · 897ADAD · ~4 min

Working with JSON (parsing) in Objective-C for iOS

ios разработка json twitter

Another post — to help things settle in my own head. About working with JSON in Objective-C, using parsing of tweets from Twitter’s public timeline as an example.

[↵] open page rabota-s-json-parsing-v-objective-c-pri-razrabotke-pod-ios.md
-rw-r--r-- 3.5K Aug 16, 2011 · 457C13F · ~3 min

Recap of Apple Developers Community #7 meetup

ios продвижение приложений

Went to Apple Developers Community #7 today. The talks were about marketing iOS apps. Two people effectively presented — a representative from Nevosoft, who seem to crank out games on a conveyor belt, and one indie developer.

[↵] open page resume-vstrechi-apple-developers-community-7.md
makoni@arm1:~/blog$ cd .. // ↵ back to all posts