Skip to main content

HTTP Connection problems on iOS 9 for Apps built with XCode 7 – How to fix that

Guess what? iOS 9 and XCode 7 are finally out, and – like almost always – there’s the usual number of breaking changes that will drive most developers mad. Among the biggest ones there’s the new Apple Transport Security (ATS) feature, which happens to be enabled by default starting from iOS 9.0 and OSX 10.11 and will basically block any non-HTTPS connection for your App.

Yeah, you’ve read it right. Here’s the Apple official statement about that:

It improves the privacy and data integrity of connections between an app and web services by enforcing additional security requirements for HTTP-based networking requests. Specifically, with ATS enabled, HTTP connections must use HTTPS (RFC 2818). Attempts to connect using insecure HTTP fail. Furthermore, HTTPS requests must use best practices for secure communications.

This will undoubtely translate into tears of joy for a lot of developers relying to home-made web services hosted on non-HTTPS environments or non-TLS based storage services (such as Amazon AWS).

Read More

How to update your CocoaPod (when you forgot how to do it)

CocoaPod is wonderful but, let’s just face it, their documentation sucks. The whole guide website is mostly inaccurate and implies you already have an extensive know-how of their interface and terminology, which tend to be unfriendly and differ from almost any other developer environment, be it linux, windows or even mac. Hence why there is a recurring scenario, for me at least, when I have to create a new Pod – or update my existing one – and I simply cannot remember how to effectively do that. Not even a clue. Not at all.

That’s why I resolved to write it down, at least for the update process. Here it is, hoping to save someone else’s day other than mine. Read More

imageNamed not found and other Assets/Resource Files issues after creating a new CocoaPod library

Some days ago i wrote a post to announce that my DownPicker component library just became available on CocoaPods. Shortly after the pull of the refactoring I made to make everything compliant with the CocoaPods public trunk interface, some users noticed that the component – only when installed as a pod using the pod install  command –  was unable to properly display the embedded images. A strange behaviour indeed, since I had them included in the  /Assets/ folder, which path is obviously included in the wildcard reference i set to the resource_bundle  property of the  .podspec file:

After a quick check it turned out that the issue was related to the component code itself: the method I used to reference my image wasn’t referencing any bundle, expecting the resource files to be in the root path.

This is something that would work on a manually added component – such as it was until few days ago – but not for a CocoaPod.

Luckily enough, the fix was quite straightforward: all I had to do was creating a reference to the bundle itself and passing it to the imageNamed method using the additional overload which serves this exact purpose:

This small update can be used for any other asset / resource file not found, it won’t break your existing code and it will work even for manual installations. If you’re also facing a similar issue, chances are that it will save your day too.

Happy coding!

EDIT: just found this thread on StackOverflow containing an almost identical approach. You might want to check it out for future updates regarding this issue.

 

DownPicker is now available through CocoaPods

A while ago I wrote an article about DownPicker, an open-source GitHub project written in Objective-C to make Android-like drop-down-lists on iOS like the one shown in the following image:

UITextField.DownPicker

For additional info about DownPicker installation and features you can read my previous post here.

In case you want to try it (or if you’re already using it) I’m pleased to inform you that DownPicker has been added to CocoaPods, the well-known dependency manager for Objective-C and Swift iOS components. If you never heard about it you can learn an excellent way to manage your iOS project by reading their official guide.

Installing DownPicker using CocoaPods is just as easy as adding this line to your Podfile:

Here are the CocoaPods relevant meta info:

CI Status Version License Platform

You’re still free to install it manually, as explained in the project GitHub page or directly in the official repository README doc.

Here are some useful links regarding the project:

Happy coding!

 

DownPicker: A lightweight DropDownList / ComboBox for iOS written in Objective-C

Quick links: Project Page – GitHub – Pod

Eventually, while developing in iOS, you’re going to find yourself looking for a control allowing the user to pick an option from a drop-down, selectable list of items: any UI has something like that: drop down lists, combo boxes, expand & collapse views or anything that could resemble the behaviour of an HTML <select>  element.

Problem is, iOS doesn’t feature anything like that. Except for the UIPickerView control, which often isn’t what we really need because of its excessive height and its heavy-impact look, which isn’t always as pretty as Apple designers thought it would be, at least in real-case scenarios. Conversely, we often need it to be simpler, taking less space and/or decently blending with other TextField elements.

 

UIPickerView in action: not always pretty.
UIPickerView in action: not always pretty.

With that thought in mind I pulled out DownPicker, an iOS control who can mimic the behaviour of a DropDownList/ComboBox using default iOS UI elements only: an UITextField to prompt the user to tap (and then show the selected item) and an UIPickerView to handle the selecting.

Read More

Close