Also, if your tileset files weren't part of the same root folder as the map when you were making it, it won't know where to look for the right file. To correct this, whenever you import the tmx map into xcode resources, click on it and it should show xml code and edit the 4th line to read;
<image source="yourspritesheet" width="NUMBER" height="NUMBER"/>.
You would get the error:
exec_arithmetic error on rect.origin.x = (gid % max_x) * (tileSize_.width + spacing_) + margin_;