Mac Dev Weekly

So I’ve started some Mac Dev and I’m looking for useful sites but there aren’t many out there.

Ray Wenderlich has a few tuts.

There is the Big Nerd Ranch book.
Website

http://macdevweekly.com/

Previous Issues

http://macdevweekly.com/issues

RSS Feed

http://macdevweekly.com/issues.rss

FMDB

Useful ways to get data out of FMDB.

Count

NSUInteger count = [db intForQuery:@"SELECT COUNT(field) FROM table_name"];

Make sure to include the FMDatabaseAdditions.h header file to use intForQuery:

Max

NSUInteger max = [db intForQuery:@"SELECT MAX(field) FROM table_name"];

Min

NSUInteger min = [db intForQuery:@"SELECT MIN(field) FROM table_name"];

Average

NSUInteger average = [db intForQuery:@"SELECT AVG(field) FROM table_name"];

Sum (Σ)

NSUInteger sum = [db intForQuery:@"SELECT SUM(field) FROM table_name"];

Total

NSUInteger total = [db intForQuery:@"SELECT TOTAL(field) FROM table_name"];

https://www.sqlite.org/lang_aggfunc.html

Done button on NumPad

I’ve been researching adding a done button to a NumPad and keep getting the same error:

Can't find keyplane that supports type 4 for keyboard iPhone-PortraitChoco-NumberPad; using 2705787216_PortraitChoco_iPhone-Simple-Pad_Default

And it seems to take a lot of code.

Another option would be to add a toolbar above the keyboard.

Not sure how well this will work with TPKeyboardAvoiding but let’s see, and it does!

Grouping Data in Sections

I’ve been looking round for some tutorials on how to group data in sections.

This is unbelievably easy in CoreData but how do you do it with your own data and models.

Previous articles I’d found I either couldn’t get to work or didn’t work as expected.

I’ve recently found this article:

http://behindtechlines.com/2014/04/uitableview-arrange-custom-model-objects-without-core-data-in-sections/

SQLite Help

Order By Date

Dates are stored as TEXT or if you want a number from 1970.

If they are TEXT and you want to sort them you need to convert them to a Date first.

SELECT * FROM Table ORDER BY date(dateColumn) DESC

WatchKit – Xcode – Updating Bundle Identifiers

General – Targets

APPNAME
Identity
Bundle Identifier
com.alexhedley.APPNAME

Check in the Info.plist

Bundle identifier

APPNAME WatchKit Extension
com.alexhedley.APPNAME.watchkitextension

Bundle identifier

NSExtension
NSExtensionAttributes
WKAppBundleIdentifier

APPNAME WatchKit App
com.alexhedley.MeatCooker.watchkitapp

Bundle identifier

WKCompanionAppBundleIdentifier

Mac App Icon

Add the value to a PList

  • Create an icon .icns resource file
  • Edit the Info.plist file and change the “CFBundleIconFile” value string to “icon”

I use http://www.img2icnsapp.com/ to make an .icns from an image

Checkout the following instructions (link):

Use iconutil to Create an icns File Manually

The iconutil command-line tool converts iconset folders to deployment-ready, high-resolution icns files. (You can find complete documentation for this tool by entering man iconutil in Terminal.) Using this tool also compresses the resulting icns file, so there is no need for you to perform additional compression.

To convert a set of icons to an icns file

Enter this command into the Terminal window:

iconutil -c icns <iconset filename>

where <iconset filename> is the path to the folder containing the set of icons you want to convert to icns. The output is written to the same location as the iconset file, unless you specify an output file as shown:

iconutil -c icns -o <icon filename> <iconset filename>


Add the .iconset folder with the following 10 items:

icon_16x16.png
icon_16x16@2x
.png
icon_32x32
.png
icon_32x32@2x
.png
icon_128x128
.png
icon_128x128@2x
.png
icon_256x256
.png
icon_256x256@2x
.png
icon_512x512
.png
icon_512x512@2x
.png


I also use a great utility (http://makeappicon.com/) to create iOS icons with all the correct sizes.

They’ve added watch support so I’ve suggested Mac sizes too.

(It already has Android)

Follow

Get every new post delivered to your Inbox.