How to see current auto layout issues

1 Comment

Screen Shot 2016-03-23 at 6.26.56 AM.png

Advertisements

How to add external xcode project to existing on

2 Comments

Say you’ve got another git repos of one xcode project (like a library) and you want to build and compile it in another. Here is how you include the library xcode project in your new xcode project.

Step 1: Set up git submodule

Get the name of the git repos you want to include and add it as a submodule

git submodule add git@ghe.xxx/yyy.git /externals/name
git submodule update --init --recursive

This adds the external repos to your project, and then updates it.
Go here for more details.

http://stackoverflow.com/questions/2140985/how-to-set-up-a-git-project-to-use-an-external-repo-submodule

Step 2: Drag in your project

Now open finder, and drag in your external project folder from your submodule folder. Not somewhere else on disk.

Screen Shot 2016-02-24 at 10.22.41 AM.png

Doing this will add the subproject to your new project, while also creating the necessary schemes to build your external project as a library with your new one.

Screen Shot 2016-02-24 at 10.22.53 AM.png

You can now flip back and forth between schemes and edit as required.

Happy coding!

How to view crash logs MacOS

Leave a comment

If you build a build error in Xcode

Screen Shot 2016-02-01 at 8.47.58 AM

You can view these logs via a tool built into Apple OS.
Cd to the above directories and open the log files
> cd ~/Library/Logs/DiagnosticReports
> open ruby_xxx.crash

Screen Shot 2016-02-01 at 8.48.18 AM

You can then see from above code that you fail in ruby string.c land. Ruby version error.

This program is called the Console application and you can find it in your applications folder.

Screen Shot 2016-02-01 at 8.49.45 AM

XCode Autolayout

Leave a comment

There’s been some changes in XCode since I last did iOS.

Do get a basic layout, just drag your elements out onto the page.

Basically, hold down the control key, left click and drag off your image to the space around it, and some pop-ups should appear that will let you auto center.

autolayout

Select center horizontally or vertically.

You can also control drag onto yourself.

autolayout-drag-onto-yourself

You can also select some stuff in the menu to help resolve autolayout issues.

autolayout-editor-options

Now here’s the tricky bit. See that wAnyhAny thing at the bottom? Make sure it looks like this. If you mess with this and you don’t know what you are doing (like me) you will have some elements not appear when you run the simulator – basically because this governs whether you are on iPad, iPhone, landscape ect. So if you get this wrong, your elements may not ever show up (depending on the simulator hardware you select).

wAnyHany

If you ever want to see all the elements you have on your view, click that little box in the lower right hand corner. You can then delete or do whatever you want with them.

element-view

Learning iOS via the Robots And Pencils Academy

3 Comments

Hi all,

I am very excited to announce the launch of a new service me and my friend Michael have been working on.

It’s called The Robots and Pencils Academy and it’s basically screencasts for people who wanting to learn iOS.

As a recent student of iOS, I know how challenging it can be to get started.

New language.
New tools.
New technology.

It can be overwhelming.

This is the website I wish existed when I got started, and because we love sharing what we’ve learned with others, these screencasts are the result.

Getting started

If you are looking for a gentle introduction to Xcode or iOS development in general checkout:



If you just want to see what Objective-C looks like watch:



and a some others we recently created can be found here.

Training

We will also be offering two day bootcamps through the site. Next one is here in Calgary at the end of the month and another coming up in Winnipeg. You can read more about those courses here:

http://academy.robotsandpencils.com/training

Thank you for listening. Please share this with anyone you think may be interested.

Sincerely,

Jonathan & Michael

Working Effectively With Xcode

1 Comment

Here are some notes from WWDC’s Session 402 – Working Effectively with Xcode video (signin required).

Behaviors

Behaviors let you setup some nice editor defaults that make debugging and dealing with build errors less annoying in Xcode.

You can get to Behaviors via Xcode preferences (Command ,) -> Behaviors and changing the actions on the right, for various triggers on the left.

Here are some good simple ones to get you going.

Build generates new issues

Clicking on the ‘Build generates new issues’ trigger and selecting ‘Show tab named’ Build will open a new tab if a build error occurs and put the output there. This is nice because it doesn’t mess up your current edit file and force you to step back once you fix the error.

Run pauses

This one is handy for when you hit a break point, and you want to do your debugging in a separate tab called debug.

Console window

Say you want to bring up a console window anytime you run your application. In Behaviors select the ‘Run Starts’ trigger and select ‘Show a tab named’ and enter ‘Console’.

Define your own edit code behavior

By clicking the ‘+’ sign and assigning a shortcut key, you can define your own edit code behavior and hit a shortcut key every time you want Xcode to setup your current window for code editting.

Simply hit the ‘+’ sign

Double click the command key icon on that line

And assign a short cut (i.e. F10).

Then setup your behaviors (in this case I like to hide all the panels and menus I’m not interested in).

Emacs gestures

Xcode supports a lot of emacs key bindings:

Control A/E Beginning and end of line
Control N New line
Control B Backward
Control F Forward

Command Control E – inscope variable name change

Open Quickly options

Shift Command O opens a file quickly in Xcode.
To open new file in assistant editor go: Option Return

To open somewhere else tab go: Option Shift Return
and use the arrows keys to select open location.

How to kill Xcode from the command line

7 Comments

#!/bin/bash
echo "Killing xcode..."
kill $(ps aux | grep 'Xcode' | awk '{print $2}')

Older Entries

%d bloggers like this: