Tag: iphone

Why is this code raising the “CoreData: error: (19) PRIMARY KEY must be unique” error?

This code raises the “CoreData: error: (19) PRIMARY KEY must be unique” error. The Day entity has only a when attribute which is an NSDate, and a to-many relationship called tasks. Why this error? If a Day with a specific date is already stored, I fetch it, otherwise I insert it. So, for each day […]

Keep zoomable image in center of UIScrollView

In my iPhone app, I need to provide the user with an ability to zoom/pan a large-ish image on the screen. This is quite simple: I use UIScrollView, set max/min scale factors and zooming/panning works as expected. Here’s where things get interesting. The image is a dynamic one, received from a server. It can have […]

iPhone to RS-232 via Bluetooth

I’m looking to connect my iPhone to an RS-232 serial device via Bluetooth. Has anyone implemented this successfully and can offer advice on hardware to use? It’s kind of tricky because of the need for the Apple Authentication Processor with the device. The best potential device I’ve found is this guy but it only comes […]

Xcode error: calling -display has no effect

Whenever I load my SpriteKit app, it logs this error: <CAMetalLayer: 0x15f57fa70>: calling -display has no effect., and it doesn’t properly display many objects. I have tried recreating the scene and removing my code, both of which have done nothing. For a while I thought this might have been a bug with the new Xcode […]

iOS 8 action extension icon is blank on device (works in simulator)

Edit2: I’ve distilled the problem down to the simplest project I can. Here’s the setup. I created a new single view app and immediately added a new Action extension target. I created a new icon set in the .xcassets file and added an iPad retina sized icon (I’ve tried filling in all the icons, the […]

Conditionally including a library for different iOS SDK versions?

I’m sure this has got a simple answer, but it’s stumping me 🙁 I’m trying to build an app that will run on iOS versions 4.3 and 5.0. I’m fine with the idea of checking for capabilities at runtime with -respondsToSelector, but in order to use the Twitter functionality I need to include the Twitter […]

Unwind segue from navigation back button in Swift

I have a settings screen, in that I have a table cell. By clicking on that I take to another screen where user can choose an option and I want it back in the previous view controller when back button is pressed. I can put a custom bar button item, but I want to return […]

How to change initial tab bar selection programmatically

Having problems changing the initial tab bar selection on an application (i.e. the middle tab is selected on app launch rather than the leftmost tab). The app uses storyboards and the tab bar controller was added later on in development via the storyboard method. tabBarController.selectedIndex = 1; the above code doesn’t work (because I don’t […]

In iOS, how to connect to a server using https with self-signed certificate on the server?

I am developing for iOS 5 and really don’t want to use un-ARCed codes so I chose to implement this myself instead of using AFNetworking. Also this might be a big question so I split it into two smaller parts. 1) Connecting to the server using https in iOS 5. I use the codes extracted […]

Clear button on UITextView

How can add a clear button (cross inside a circle) for text view like in text field?