Tag Archives: Xcode

How to submit your apps to the App Store with Xcode 8

In case it’s been a while that you had to deal with App Store submissions, here’s a quick refresher. This assumes that iTunes Connect is ready to receive a new app or update.

Make sure that the version number and build values have both been increased if your submission is an update. In Xcode, do the following:

  • verify that the Archive Scheme is set to Release (under Product – Scheme – Edit Scheme)
  • make sure that you’ve selected “Generic iOS Device” as the active scheme
  • head over to Product – Archive to create an archive of your current version
  • the Organizer window opens, showing previously archived versions of your app (don’t delete those)
  • now hit Validate to see if there are any issues with your app
  • if all is well, hit the big blue Upload to App Store button
  • now pray that your app is approved





How to fix http load errors in Xcode

In 2016, Apple have implemented a new rule that won’t let us load data from unsecured websites anymore. That’s those beginning with http:// instead of https:// (the latter ones are secured with an SSL certificate, and hence traffic is encrypted).

When you load an unsecured source, you’ll get an error message like this:

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.

If a secured source of the data is available, it’s probably the easiest method to change the feed. However, if that’s not an option, we can convince Xcode to let our apps download what’s known as data from “arbitrary” sources. Here’s how to do it.

First, in Xcode, navigate to your project’s target and find the Info tab. The target is the one that has your app icon showing, NOT the blue Xcode icon (top left, in the Project Navigator).

Now right-click on any of the many lines and select “Add Row”. This adds a value to your Info.plist file. Notice a list that comes up. Either select “App Transport Security” (if you can find it), or type NSAppTransportSecurity (it usually auto-completes). The entry will change into App Transport Security.

Let’s add the appropriate values to this new entry now. Hover over your new row now and select the little plus icon that comes up, then choose “Allow Arbitrary Loads” from the list. Alternatively, type in NSALlowsArbitraryLoads. Again this value will change to Allow Arbitrary Loads. Notice that this entry is a BOOL, and it needs to be set to YES on the right hand side. Go ahead and do that.

This will be enough to allow HTTP loads inside your app from any URL. You can restrict this to only certain URLs or hosts by adding another entry to the App Transport Security line, namely “Exception Domains”. Add each domain to its own line, and only data from those will be allowed to load via HTTP. If you want to use restricted domains, make sure to set the Allow Arbitrary Loads value to NO.





How to avoid “Capturing ‘self’ strongly in this block is likely to lead to a retain cycle”

I was trying to update a UILabel from inside a block the other day, and was puzzled by the above Xcode warning: “Capturing ‘self’ strongly in this block is likely to lead to a retain cycle”. The full code looked like this:

 

self.mainController.controllerPausedHandler = ^(GCController *controller){

        // triggers a warning
        [self displayMessage:@"Pause Button"];

    };

As it turns out, the trouble was that a block executed in self cannot capture a reference to itself (self) without there being a never ending loop involved. It’s probably to complicated for me to understand and/or care about, but thankfully there’s a relatively easy way to correct this problem.

Continue reading





How to fix “no rule to process file” warning in Xcode

The other day Xcode was trying to tell me that it had “no rule to process a file”. It was a simple readme file that I had created on GitHub and subsequently pulled into my working copy.

Even though the project compiled fine, if there is a warning we can eliminate, we definitely should. Turns out it’s easy fix this problem.

Click on your project in the Project Navigator (the blue item on the left where you see all your project files), then head over to Build Phases. You’ll find a section called Compiled Sources. Expand it to see a selection of files.

Select the one Xcode is complaining about and remove it by clicking the little minus sign at the bottom.

Screen Shot 2015-12-09 at 12.51.27

Build the project again and see that warning disappear for good.





How to build WordPress for iOS (2015)

WordPress-LogoThe WordPress for iOS project has changed and grown over the years. While it’s still Open Source, it’s not as easy as “checkout and deploy” anymore. You may encounter several pitfalls along the way.

At the time of writing, the current version of WordPress for iOS is 5.7, with 5.8 just around the corner. In this article I’ll show you how to build the project and deploy it on your own devices.

Continue reading





Getting started with Unit Testing in Xcode 7

Unit Testing, or XCTesting as it’s called since Xcode 5, is a process that lets us test several aspects of our apps. For example, we can see if methods have return values we expect, and if not, flag this up to us. Since Xcode 7 and iOS 9 we can even test user interface events too.

Testing has come a long way in Xcode, but it’s also long been a mystery to me. I decided to explore it and make some notes so I wouldn’t forget.

Turns out that Unit Testing isn’t actually that difficult a concept to comprehend, but it’s usually presented in a way that only those with an IQ of 1000 or greater would understand it. Apple’s new document called Testing with Xcode has certainly helped me understand the basics, which I’ll discuss in this article. Continue reading