

iOS 8 Debugging Case Study - hoggle
http://www.objc.io/issue-19/debugging-case-study.html

======
jparishy
This is a really great read, especially for new iOS developers who haven't
picked up a ton of debugging tricks from experience alone.

In particular the section "Calling Conventions 101" contains a lot of very
useful information that isn't documented very well in any of the iOS resources
provided by Apple (AFAIK). Commit it all to memory, you'll be glad you did :)

~~~
mikeash
Apple uses the standard calling conventions for the CPU architectures they
use, so there's no real need nor expectation for Apple to document those
aspects beyond saying "we use the standard conventions," which they do say if
you go digging. In some instances they also replicate the documentation for
the conventions.

~~~
stephencanon
It's not obvious that you can meaningfully talk about to "the standard
conventions" on i386, x86_64, or armv7, as there are at least two widely-used
conventions for each. arm64 comes the closest to having a single "standard",
but Apple uses a (documented) tweaked version.

~~~
masklinn
> It's not obvious that you can meaningfully talk about to "the standard
> conventions" on i386, x86_64, or armv7, as there are at least two widely-
> used conventions for each.

x86_64 has the System V AMD64 ABI calling conventions which are as standard as
can be and used by almost everybody. Microsoft being their usual assholes does
not mean their ABI is anything other than their ABI.

~~~
hornetblack
Plan 9, and therefore The Go Programming language use a different one, which
is the same across all architectures supported by Plan9's assembler. (It's one
reason why cgo call's are not cheap)

------
davidbanham
Does anyone else feel like maybe the entire iOS development experience is
batshit insane?

~~~
mikeash
There's a lot of extremely frustrating and stupid aspects to it... but none of
those are in any way related to anything discussed in the article, so I find
your comment a bit odd. What makes iOS development so frustrating to me is the
constant struggle with code signing, device provisioning, Xcode crashes,
random failures to install or run programs, and all the craziness around App
Store review.

~~~
faizmokhtar
I agree. I just started to learn iOS development at my current job (around 4
months), and configuring with code signing & XCode configuration is a pain in
the ass.

~~~
ktran03
I struggled with those, but after a few years doing iOS dev, it isn't so bad.
It all eventually sticks.

And autolayout is freakin awesome imo, though I hear a lot of people groak
about it.

~~~
antimagic
Autolayout is horrible in the sense that when something isn't working, it's
really hard to figure out what went wrong. My personal favourite is when you
forget to set translatesAutoresizingMaskIntoConstraints to NO on a container
view. A whole bunch of implicit constraints pop into existence that conflict
with your actual programmed constraints, and the error message that tells you
that you have constraint conflicts really doesn't help you in figuring out
where the constraints are coming from. Eventually you figure this out, and you
don't get caught out by it any more, but in the learning phase, it's quite
painful.

Something else I really dislike when it comes to constraints - they don't play
well with animations, at least in my experience. I recently created a view
that had a variable number of square buttons in it that were laid out in a
grid two rows high. Making a nice animation when you add a new button, fading
in the new button, and sliding the others out of the way was nigh on
impossible (ie 'not possible without writing more code than if I had just done
the layout manually). And yet, this seems to be the perfect use case for auto
layouts...

~~~
dimillian
This is exactly why I don't use it. I do iOS development since the first SDK
public release, I have a love/hate relationship with Interface Builder. I used
to use it a lot, but now I use it only in small projects. Storyboard is
awesome for small apps.

But for my big projects I do 100% of the UI in the code, if the UI use a lot
of custom control, it just not worth it to use IB, the end result is that what
you see is not at all what you get. BUT it improved a lot with Xcode 6,
because now it can render custom views live in Interface Builder.

Auto layout on the other side.... it's just broken.... Every time I try to use
it I got what you mentioned in your first paragraph. And I do a lot of
animations in my apps, and playing with 10 constrains instead of a simple
frame is just .... too much of a burden.

Again, for big custom apps I don't use it, but I love those functionalities
for small & simple apps.

