iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

Remove objects using NSPredicate

I have the folloving dictionary which has many sub dictionaries. How can I remove objects where isChanged = 1 from parent dictionary using NSPredicate? { “0_496447097042228” = { cellHeight = 437; isChanged = 1; }; “100000019882803_193629104095337” = { cellHeight = 145; isChanged = 0; }; “100002140902243_561833243831980” = { cellHeight = 114; isChanged = 1; }; […]

keyboardWillShow in IOS8 with UIKeyboardWillShowNotification

I am running the same code on an IOS 7 and IOS 8 device with differing results Given a screen with two text fields In IOS 7 if I touch the first field keyboardWillShow is called but if I touch the second field when the keyboard is already shown it is not called a second […]

dataWithContentsOfURL returns NSCocoaErrorDomain Code=256 over cellular, but not wifi

Really odd problem I’m having: dataWithContentsOfURL has begun returning an error code 256 over cellular, but not over wifi. The operation couldn’t be completed. (Cocoa error 256.) I do indeed have a cellular data connection, and it is functioning, so it is not a problem with my cellular connection. Plus the code works fine on […]

Is there any way to list all swizzled methods in an iOS app?

I’m essentially looking for a way to detect when/what third party libraries swizzle. I recently ran into a situation where an ad library used an oddball fork of AFNetworking. AFNetworking swizzles NSURLSessionTask, and the two swizzles didn’t play nicely under certain circumstances. I’d really like to be able to detect and sanity check this kind […]

Force camera view in landscape with orientation lock on

I am developing an augmented reality game, and I’ve encountered an issue with the orientation of the camera view when the orientation lock of the device is on. I am using this code to load the camera view inside of a View: AVCaptureSession *session = [[AVCaptureSession alloc] init]; AVCaptureVideoPreviewLayer *captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session]; captureVideoPreviewLayer.frame […]

Interface Builder Objects not visible in my storyboard (and titles are transparent)

I am using the same version of XCode as another developer I am working with but when I open the project on my machine the interface objects are not visible in the storyboard and their names are semi-transparent. I’ve Googled around but I cannot seem to figure out why this might be happening. Any ideas […]

Strange Crash when dismissing view controller, auto-layout to blame?

I am experiencing a very strange crash, here is the backtrace. * thread #1: tid = 0x2403, 0x3379516c CoreFoundation`CFHash + 8, stop reason = EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xdefe) frame #0: 0x3379516c CoreFoundation`CFHash + 8 frame #1: 0x33797a9c CoreFoundation`CFBasicHashRemoveValue + 1408 frame #2: 0x337974ee CoreFoundation`CFDictionaryRemoveValue + 166 frame #3: 0x3420988e Foundation`-[NSISEngine removeConstraintWithMarker:] + 562 frame #4: 0x34211dbe […]

Differentiating between initial buy and free “re-buy” in StoreKit/In-App Purchase

From the StoreKit guide: If the user attempts to purchase a nonconsumable product or a renewable subscription they have already purchased, your application receives a regular transaction for that item, not a restore transaction. However, the user is not charged again for that product. Your application should treat these transactions identically to those of the […]

How to properly hide these ad banners?

(Sprite Kit Game) I want my ad banners to be hidden during gameplay. I’ve set up my project to contain both iAd and AdMob advertisement banners. Prior to adding in the AdMob SDK and the code for the AdMob advertisements, I had no problem with hiding the iAd banner when I wanted it hidden. Now […]

Zoom on a two dimensional UICollectionView

I created a UICollectionView which is horizontal and vertically. It has different UICollectionViewCells. Everything is layouted correctly. Now I am trying to make it zoomable. The UICollectionViewCells are resized correctly too. Every time the UIPinchGesture occures, I set the itemSize inside the UICollectionViewLayout dependend on the scale. TestLayout *layout = (TestLayout *) self.collectionViewLayout; CGSize newItemSize […]