Objective-C Runtime. Cocoa s Jewel in the Crown. NSConference Nicolas

Size: px
Start display at page:

Download "Objective-C Runtime. Cocoa s Jewel in the Crown. NSConference Nicolas"

Transcription

1 Objective-C Runtime Cocoa s Jewel in the Crown NSConference 2011 Nicolas

2 [isa kindof:magic]

3 1. Objective-C 2. Recipes 3. Introspection 4. Debugging

4 Objective-C Runtime OO, Smalltalk-like, dynamic extensions over C /usr/lib/libobjc.a.dylib /usr/include/objc/

5 Instances and Classes typedef struct objc_object { Class isa; } *id; typedef struct objc_class *Class; Class A (...) int i instance of B Class isa 0xA int i 0 NSString *s 0x0 BOOL NO Class B : A (...) superclass NSString *s BOOL b

6 Runtime Structure NSObject isa NSObject (meta) isa init alloc dealloc NSSet NSSet (meta) isa isa count set allobjects setwitharray: mymutableset NSMutableSet NSMutableSet (meta) Class isa 0xA isa isa addobject: setwithcapacity: removeobject:

7 Message Resolution bracket syntax is converted into objc_msgsend [myobject setvalue:3.0]; 3.0); objc_msgsend looksup the functions pointer IMP setvalue_ = class_getmethodimplementation( [myobject 3.0); it works thanks to meta-classes

8 [NSMutableSet set] NSObject isa NSObject (meta) isa init alloc dealloc NSSet NSSet (meta) isa isa count set allobjects setwitharray: NSMutableSet isa NSMutableSet (meta) isa addobject: setwithcapacity: removeobject:

9 [mymutableset count] NSObject isa NSObject (meta) isa init alloc dealloc NSSet NSSet (meta) isa isa count set allobjects setwitharray: mymutableset NSMutableSet NSMutableSet (meta) Class isa 0xA isa isa addobject: setwithcapacity: removeobject:

10 Runtime Benefits OO capabilities inheritance polymorphism Cocoa magic key-value coding plugins and frameworks UI with Interface Builder bigger underline bold responder chain database faulting undo manager

11 1. Objective-C 2. Recipes 3. Introspection 4. Debugging

12 Key-Value Coding -valueforkey: looks for methods, then ivars Person firstname { } firstname = John; lastname = Doe; [person setvaluesforkeyswithdictionary:d]; - (void)setvalue:(id)value forundefinedkey:(nsstring *)key { NSLog(@"-- unhandled key:%@", key); }

13 Categories A m1 m2 A m1 m2 A (A+Ext) - (id)m2 { /**/ } - (id)m3 { /**/

14 Method Swizzling m A 0xA [a m] -> 0xA() [a m2] -> 0xB() A+Ext m2 0xB // Google for Mike Ash implementation [a m] -> 0xB() [a m2] -> 0xA()

15 Logging NSURL Creation static IMP NSURL (Ext) + (void)swizzlemethods { // call this once, early original_initwithstring_ = method_getimplementation( class_getinstancemethod([self } // -[NSURL urlwithstring:] will now execute this method - (NSURL *)my_initwithstring:(nsstring *)s {! NSLog(@"-- my_initwithstring: %@", s);! return s);

16 High Order Functions $ python >>> l = ['a', 'bb', 'ccc'] >>> filter(lambda x:len(x) > 1, l) ['bb', 'ccc'] >>> map(lambda x:'-'+x, l) ['-a', '-bb', '-ccc'] >>> reduce(lambda x,y:x+y, l) 'abbccc'

17 Filtering NSArray NSArray *a = nil]; NSArray *b = [NSArray arraywithobjects:@"a", nil]; // 1. with plain C functions b = filter(a, startswitha); // 2. with NSInvocation b = [a nil]; // 3. with Objective-C blocks, since Mac OS X 10.6 and ios 4 b = [a filteredarrayusingpredicate:! [NSPredicate predicatewithblock:! ^BOOL(id s, NSDictionary *bindings) {!! return [s hasprefix:@"a"];! }]]); // 4. with high order messaging // b = [[a filter] hasprefix:@"a"];

18 High Order Messaging (1) [[a collect] uppercasestring]; [a ("a", "bb", "ccc") a proxy runtime collect uppercasestring forwardinvocation: collect: ("A", "BB", "CCC") ("A", "BB", "CCC")

19 High Order Messaging (2) Maybe one day we ll write Objective-C like this: users.collect.name users.do.logout users.sortedby.age users.any.is.admin users.all.are.admin

20 1. Objective-C 2. Recipes 3. Introspection 4. Debugging

21 Runtime Introspection // NSObject.h - (Class)class; - (id)performselector:(sel)aselector; - (BOOL)isKindOfClass:(Class)aClass; - (BOOL)respondsToSelector:(SEL)aSelector; // NSObjCRuntime.h NSClassFromString(@"NSArray"); NSStringFromClass([NSArray class]); NSSelectorFromString(@"objetAtIndex:"); NSStringFromSelector(@selector(objectAtIndex:)); // runtime.h Method class_getinstancemethod(class cls, SEL name); const char *ivar_gettypeencoding(ivar v); IMP method_getimplementation(method m); const char *property_getname(objc_property_t property);

22

23

24

25

26

27 Runtime Browser Think class-dump, but dynamic! First version by Ezra Epstein, 2002 A development tool I found useful

28

29

30 embedded web server

31

32 Browsing the Runtime $ grep "hack" * -Ri // no, you are not alone... void *_odioushashhackstorage; BOOL _HACKpreviouslyHitPuck; BOOL _HACKpreviouslyHitKnob; BOOL _unused_ical_hack_[32]; -[NSWindow _evilhacktoclearlastlefthitinwindow]; -[UIDocumentInteractionController updatepopovercontentsizeforpresentationoftableviewhack]; -[PLStackView _validatetableviewlayerasahackforradar ];

33 Private APIs (un)safe on the App Store, blitz talk but as a dev you can write your own app anyway! // in UIStatusBarServerThread struct {! //...! NSInteger gsmsignalstrengthraw;! //...! NSUInteger datanetworktype;! //... } _statusbardata;

34 Mapping the Network

35 Scripting Cocoa $ python >>> from AppKit import NSSpeechSynthesizer >>> NSSpeechSynthesizer.availableVoices() ( "com.apple.speech.synthesis.voice.agnes", "com.apple.speech.synthesis.voice.albert", "com.apple.speech.synthesis.voice.alex",... )

36 1. Objective-C 2. Recipes 3. Introspection 4. Debugging

37 $ export OBJC_HELP=YES $ /Applications/TextEdit.app/Contents/MacOS/TextEdit (...) OBJC_HELP: describe available environment variables OBJC_PRINT_IMAGES: log image and library names as they are loaded OBJC_PRINT_LOAD_METHODS: log calls to class and category +load methods OBJC_PRINT_INITIALIZE_METHODS: log calls to class +initialize methods OBJC_PRINT_RESOLVED_METHODS: log methods created by +resolveclassmethod: and +resolveinstancemethod: (...)

38 $ export NSObjCMessageLoggingEnabled=YES $ /Applications/TextEdit.app/Contents/MacOS/TextEdit $ tail -f /tmp/msgsends-<pid> - NSLock NSLock lock + NSThread NSThread currentthread - NSThread NSObject hash - NSCFArray NSCFArray countbyenumeratingwithstate:objects:count: - NSLock NSLock unlock - NSLock NSLock lock + NSThread NSThread currentthread - NSThread NSObject hash - NSCFArray NSCFArray countbyenumeratingwithstate:objects:count: - NSLock NSLock unlock

39 DTrace $ cat objc_calls.d pid$target::*classdisplay*:entry {} pid$target::*classdisplay*:return {} $ sudo dtrace -s objc_calls.d -F -c./runtimebrowser dtrace: script 'objc_calls.d' matched 64 probes CPU FUNCTION 0 -> +[ClassDisplay classdisplaywithclass:] 0 -> -[ClassDisplay setrepresentedclass:] 0 <- -[ClassDisplay setrepresentedclass:] 0 <- +[ClassDisplay classdisplaywithclass:] 0 -> -[ClassDisplay setdisplaypropertiesdefaultvalues:] 0 <- -[ClassDisplay setdisplaypropertiesdefaultvalues:] 0 -> -[ClassDisplay header] 0 -> -[ClassDisplay setrefdclasses:] 0 <- -[ClassDisplay setrefdclasses:] (...)

40 gdb Cheat Sheet (gdb) break setpassword: (gdb) break -[Person setpassword:] (gdb) po self <Person: 0x10010c7a0> (gdb) po [invocation debugdescription] Some day, NSInvocation will have a useful debug (gdb) p (char *)_cmd $1 = 0x10fbb "setpassword:" (gdb) frame (gdb) info locals (gdb) info (classes selectors) [regex] (gdb) list +[Person string] (gdb) call [self setpassword:@"welcome"]

41 NSAutoreleasePool #include <Foundation/NSDebug.h> [NSAutoreleasePool showpools]; Autorelease Pools ==== top of stack ================ 0x583f3c0 ( NSDate) 0x583f350 (Measure) 0x5a24960 (UIWindow) (...) ==== top of pool, 23 objects ================ ==== top of pool, 0 objects ================ ==== top of pool, 0 objects ================

42 Useful Methods UIKit #ifdef DEBUG // strengthen your code [NSTimer scheduledtimerwithtimeinterval:1.0 target:application userinfo:nil repeats:yes]; #endif (gdb) po [UIView recursivedescription] <UIView: 0x4b4d3d0; frame = (0 20; ); (...) <MyView: 0x4b4b800; frame = (20 20; ); (...) <UIRoundedRectButton: 0x4b4e790; (...) <UIButtonLabel: 0x4b4f190; (...)

43 Conclusion Objective-C Runtime is not magic, it is just simple and clever Understanding Objective-C Runtime improves your code and debugging skills Objective-C is dynamic, it makes it powerful and fun!

44 [session release];

Cocoa Programming. David Chisnall. March 18,

Cocoa Programming. David Chisnall. March 18, March 18, 2010 http://cs.swan.ac.uk/~csdavec/papers/safariwebcast.pdf The Story So Far What is Cocoa? Why Cocoa? GNUstep Overview GNUstep Look and Feel A Brief History of Objective-C 1980: Smalltalk-80

More information

Objective-C and COCOA Applications

Objective-C and COCOA Applications Objective-C and COCOA Applications Fall, 2012 Prof. Massimiliano "Max" Pala pala@nyu.edu Overview X-Code IDE Basics Objective-C Classes Methods Invocations Important Types Memory Management Protocols Exceptions

More information

Collections & Memory Management. Lecture 2

Collections & Memory Management. Lecture 2 Collections & Memory Management Lecture 2 Demo: Accessing Documentation Collections NSArray a list of objects in order [array objectatindex:0] [array objectatindex:3] Counting starts at zero, not one NSSet

More information

ITP 342 Mobile App Dev. Unit Testing

ITP 342 Mobile App Dev. Unit Testing ITP 342 Mobile App Dev Unit Testing Testing Xcode provides you with capabilities for extensive software testing. Testing your projects enhances robustness, reduces bugs, and speeds the acceptance of your

More information

Mobile Application Development

Mobile Application Development Mobile Application Development Lecture 12 Introduction to ObjectiveC 2013/2014 Parma Università degli Studi di Parma Lecture Summary ObjectiveC language basics Classes and objects Methods Instance variables

More information

Review. iphone Application Programming Lecture 2: Objective-C, Cocoa. History. Objective-C. Device restrictions. Interaction paradigm changes

Review. iphone Application Programming Lecture 2: Objective-C, Cocoa. History. Objective-C. Device restrictions. Interaction paradigm changes Review iphone Application Programming Lecture 2: Objective-C, Cocoa Device restrictions Gero Herkenrath Media Computing Group RWTH Aachen University Winter Semester 2013/2014 http://hci.rwth-aachen.de/iphone

More information

CS193E Lecture #3 Categories and Protocols Cocoa Memory Management

CS193E Lecture #3 Categories and Protocols Cocoa Memory Management CS193E Lecture #3 Categories and Protocols Cocoa Memory Management Winter 2008, Dempsey/Marcos 1 Today s Topics Questions from Assignment 1A or 1B? Categories Protocols Cocoa Memory Management Object life

More information

COCOA WORKSHOP PART 1. Andreas Monitzer

COCOA WORKSHOP PART 1. Andreas Monitzer COCOA WORKSHOP PART 1 Andreas Monitzer 2009-02-17 WORKSHOP SCHEDULE 1. Introduction, Foundation 2. GUI Programming 3. Hands-On 4. Advanced 2009-02-17 2009-02-19 2009-02-24 2009-02-26 STRUCTURE Introduction

More information

Collections. Fall, Prof. Massimiliano "Max" Pala

Collections. Fall, Prof. Massimiliano Max Pala Collections Fall, 2012 Prof. Massimiliano "Max" Pala pala@nyu.edu Overview Arrays Copy and Deep Copy Sets Dictionaries Examples Arrays Two Classes NSArray and NSMutableArray (subclass of NSArray) int main(int

More information

Design Phase. Create a class Person. Determine the superclass. NSObject (in this case)

Design Phase. Create a class Person. Determine the superclass. NSObject (in this case) Design Phase Create a class Person Determine the superclass NSObject (in this case) 8 Design Phase Create a class Person Determine the superclass NSObject (in this case) What properties should it have?

More information

Review. iphone Application Programming Lecture 2: Objective-C, Cocoa. History. Objective-C. Device restrictions. Interaction paradigm changes

Review. iphone Application Programming Lecture 2: Objective-C, Cocoa. History. Objective-C. Device restrictions. Interaction paradigm changes Review iphone Application Programming Lecture 2: Objective-C, Cocoa Device restrictions Gero Herkenrath Media Computing Group RWTH Aachen University Winter Semester 2013/2014 http://hci.rwth-aachen.de/iphone

More information

CS193P - Lecture 3. iphone Application Development. Custom Classes Object Lifecycle Autorelease Properties

CS193P - Lecture 3. iphone Application Development. Custom Classes Object Lifecycle Autorelease Properties CS193P - Lecture 3 iphone Application Development Custom Classes Object Lifecycle Autorelease Properties 1 Announcements Assignments 1A and 1B due Wednesday 1/13 at 11:59 PM Enrolled Stanford students

More information

Objective-C Primer. iphone Programmer s Association. Lorenzo Swank September 10, 2008

Objective-C Primer. iphone Programmer s Association. Lorenzo Swank September 10, 2008 Objective-C Primer iphone Programmer s Association Lorenzo Swank September 10, 2008 Disclaimer Content was blatantly and unapologetically stolen from the WWDC 2007 Fundamentals of Cocoa session, as well

More information

CS193p Spring 2010 Thursday, April 29, 2010

CS193p Spring 2010 Thursday, April 29, 2010 CS193p Spring 2010 Announcements You should have received an e-mail by now If you received e-mail approving enrollment, but are not in Axess, do it! If you have any questions, please ask via e-mail or

More information

ios: Objective-C Primer

ios: Objective-C Primer ios: Objective-C Primer Jp LaFond Jp.LaFond+e76@gmail.com TF, CS76 Announcements n-puzzle feedback this week (if not already returned) ios Setup project released Android Student Choice project due Tonight

More information

Stanford CS193p. Developing Applications for iphone 4, ipod Touch, & ipad Spring Stanford CS193p Spring 2011

Stanford CS193p. Developing Applications for iphone 4, ipod Touch, & ipad Spring Stanford CS193p Spring 2011 Developing Applications for iphone 4, ipod Touch, & ipad Today Dynamic Binding Introspection Foundation Framework Enumeration More Objective-C Allocating and Initializing objects Memory Management Demo

More information

Advanced Object- C Features

Advanced Object- C Features Advanced Object- C Features Advanced Features Proper6es Categories Protocols Delegates Selectors Key- Value Coding Predicators Proper6es Provide access to object a?ributes Shortcut to implemen6ng ge?er/se?er

More information

IPHONE DEVELOPMENT. Getting Started with the iphone SDK

IPHONE DEVELOPMENT. Getting Started with the iphone SDK IPHONE DEVELOPMENT Getting Started with the iphone SDK OBJECTIVE-C The Big Picture STRICT SUPERSET OF C The Objective C Language Any C stuff applies Standard libs are here (time, sqrt etc) The C Language

More information

Cocoa. Last Week... Music 3SI: Introduction to Audio/Multimedia App. Programming. Today... Why Cocoa? Wikipedia - Cocoa

Cocoa. Last Week... Music 3SI: Introduction to Audio/Multimedia App. Programming. Today... Why Cocoa? Wikipedia - Cocoa Music 3SI: Introduction to Audio/Multimedia App. Programming IDE (briefly) VST Plug-in Assignment 1 hints Last Week... Week #5-5/5/2006 CCRMA, Department of Music Stanford University 1 2 Today... Cocoa

More information

Timers Timer CPRE 388

Timers Timer CPRE 388 Timers CPRE 388 Timers A timer provides a way to perform a delayed action or a periodic action Thetimer waits until a certain time interval has elapsed and then fires, sending a specified message to a

More information

CS193E Lecture 7. Document-based Applications NSTableView Key-Value Coding

CS193E Lecture 7. Document-based Applications NSTableView Key-Value Coding CS193E Lecture 7 Document-based Applications NSTableView Key-Value Coding Agenda Questions? Review: delegates, MVC Document-based apps Table views Key Value Coding Model, View, Controller Controller Model

More information

Data Management

Data Management Core Data Utility Tutorial Data Management 2010-09-19 Apple Inc. 2005, 2010 Apple Inc. All rights reserved. exclusion may not apply to you. This warranty gives you specific legal rights, and you may also

More information

OVERVIEW. Why learn ios programming? Share first-hand experience. Identify platform differences. Identify similarities with.net

OVERVIEW. Why learn ios programming? Share first-hand experience. Identify platform differences. Identify similarities with.net OVERVIEW Why learn ios programming? Share first-hand experience. Identify platform differences. Identify similarities with.net Microsoft MVP for 4 years C#, WinForms, WPF, Silverlight Joined Cynergy about

More information

IPHONE. Development Jump Start. phil nash levelofindirection.com

IPHONE. Development Jump Start. phil nash levelofindirection.com IPHONE Development Jump Start phil nash levelofindirection.com Who? been in a professional developer for the last 18 years - mostly windows - c++, c#, Java, Python etc - then, Aug 2008, decided to write

More information

ITP 342 Mobile App Dev. Fundamentals

ITP 342 Mobile App Dev. Fundamentals ITP 342 Mobile App Dev Fundamentals Objective-C Classes Encapsulate data with the methods that operate on that data An object is a runtime instance of a class Contains its own in-memory copy of the instance

More information

ITP 342 Advanced Mobile App Dev. Memory

ITP 342 Advanced Mobile App Dev. Memory ITP 342 Advanced Mobile App Dev Memory Memory Management Objective-C provides two methods of application memory management. 1. In the method described in this guide, referred to as manual retain-release

More information

ITP 342 Mobile App Dev. Data Types

ITP 342 Mobile App Dev. Data Types ITP 342 Mobile App Dev Data Types Types of Data Types C Primitives The vast majority of Objective-C s primitive data types are adopted from C, although it does define a few of its own to facilitate its

More information

Questions. Exams: no. Get by without own Mac? Why ios? ios vs Android restrictions. Selling in App store how hard to publish? Future of Objective-C?

Questions. Exams: no. Get by without own Mac? Why ios? ios vs Android restrictions. Selling in App store how hard to publish? Future of Objective-C? Questions Exams: no Get by without own Mac? Why ios? ios vs Android restrictions Selling in App store how hard to publish? Future of Objective-C? Grading: Lab/homework: 40%, project: 40%, individual report:

More information

ios Development Lecture 1 Introduction to Objective-C Ing. Simone Cirani

ios Development Lecture 1 Introduction to Objective-C Ing. Simone Cirani ios Development Lecture 1 Introduction to ObjectiveC Ing. Simone Cirani email: simone.cirani@unipr.it http://www.tlc.unipr.it/cirani Simone Cirani, Ph.D. Corso IFTS Cisita ios Development 2014 Parma Università

More information

Author Bob Ippolito Conference. PyObjC Hacking. PyCon DC, March 2005

Author Bob Ippolito Conference. PyObjC Hacking. PyCon DC, March 2005 Author Bob Ippolito Conference PyObjC Hacking PyCon DC, March 2005 Intended Audience Python developers using Mac OS X 10.3 or later... that aren't (very) afraid of C Who probably know a little about Objective-C...

More information

Working Effectively with Objective-C on iphone OS. Blaine Garst Wizard of Runtimes

Working Effectively with Objective-C on iphone OS. Blaine Garst Wizard of Runtimes Working Effectively with Objective-C on iphone OS Blaine Garst Wizard of Runtimes 2 Working Effectively with Objective-C on ios 4 Blaine Garst Wizard of Runtimes 3 Objective-C is the language of Cocoa

More information

Objective-C and Cocoa User Guide and Reference Manual

Objective-C and Cocoa User Guide and Reference Manual Objective-C and Cocoa User Guide and Reference Manual Version 7.1 Copyright and Trademarks LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual Version 7.1 March 2017 Copyright 2017

More information

Announcement. Final Project Proposal Presentations and Updates

Announcement. Final Project Proposal Presentations and Updates Announcement Start Final Project Pitches on Wednesday Presentation slides dues by Tuesday at 11:59 PM Email slides to cse438ta@gmail.com Extensible Networking Platform 1 1 - CSE 438 Mobile Application

More information

Contents. iphone Training. Industry Trainers. Classroom Training Online Training ON-DEMAND Training. Read what you need

Contents. iphone Training. Industry Trainers. Classroom Training Online Training ON-DEMAND Training. Read what you need iphone Training Contents About iphone Training Our ios training classes can help you get off to a running start in iphone, ipod and ipad app development. Learn from expert Objective-C developers with years

More information

Principles of Programming Languages. Objective-C. Joris Kluivers

Principles of Programming Languages. Objective-C. Joris Kluivers Principles of Programming Languages Objective-C Joris Kluivers joris.kluivers@gmail.com History... 3 NeXT... 3 Language Syntax... 4 Defining a new class... 4 Object identifiers... 5 Sending messages...

More information

Building a (Core) Foundation. Rob Napier

Building a (Core) Foundation. Rob Napier Building a (Core) Foundation Rob Napier A little background Mac OS X since 10.4 iphoneos since release Cisco Jabber, The Daily, RNCryptor Focus on low-level Today: Mac developer for... KACE NAPIER KUMAR

More information

Introduction to PyObjC

Introduction to PyObjC Author Bob Ippolito Conference Introduction to PyObjC PyCon DC, March 2005 Intended Audience Python developers using Mac OS X 10.3 or later Spies from the Linux and Win32 camps Hopefully a GNUstep porter/maintainer

More information

Objective-C. Stanford CS193p Fall 2013

Objective-C. Stanford CS193p Fall 2013 New language to learn! Strict superset of C Adds syntax for classes, methods, etc. A few things to think differently about (e.g. properties, dynamic binding) Most important concept to understand today:

More information

CS 47. Beginning iphone Application Development

CS 47. Beginning iphone Application Development CS 47 Beginning iphone Application Development Introductions Who, why, which? Shameless Plug: LoudTap Wifi Access (If it works..) SSID: Stanford Username/password: csp47guest Expectations This is a programming

More information

Assignment II: Foundation Calculator

Assignment II: Foundation Calculator Assignment II: Foundation Calculator Objective The goal of this assignment is to extend the CalculatorBrain from last week to allow inputting variables into the expression the user is typing into the calculator.

More information

iphone Programming Touch, Sound, and More! Norman McEntire Founder Servin Flashlight CodeTour TouchCount CodeTour

iphone Programming Touch, Sound, and More! Norman McEntire Founder Servin Flashlight CodeTour TouchCount CodeTour iphone Programming Touch, Sound, and More! Norman McEntire Founder Servin 1 Legal Info iphone is a trademark of Apple Inc. Servin is a trademark of Servin Corporation 2 Welcome Welcome! Thank you! My promise

More information

ITP 342 Mobile App Dev. Animation

ITP 342 Mobile App Dev. Animation ITP 342 Mobile App Dev Animation Core Animation Introduced in Mac OS X Leopard Uses animatable "layers" built on OpenGL UIKit supports Core Animation out of the box Every UIView has a CALayer behind it

More information

Tools & Languages: Objective-C

Tools & Languages: Objective-C The Objective-C Programming Language Tools & Languages: Objective-C 2010-12-08 Apple Inc. 2010 Apple Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system,

More information

Tools & Languages: Objective-C

Tools & Languages: Objective-C The Objective-C Programming Language Tools & Languages: Objective-C 2009-10-19 Apple Inc. 2009 Apple Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system,

More information

Objective-C ICT/7421ICTNathan. René Hexel. School of Information and Communication Technology Griffith University.

Objective-C ICT/7421ICTNathan. René Hexel. School of Information and Communication Technology Griffith University. Objective-C 2.0 2501ICT/7421ICTNathan René Hexel School of Information and Communication Technology Griffith University Semester 1, 2012 Outline Fast Enumeration and Properties 1 Fast Enumeration and Properties

More information

Discovering the ios Instruments Server

Discovering the ios Instruments Server Discovering the ios Instruments Server Troy Bowman Hex-Rays troy@hex-rays.com Recon Montreal 2018 Purpose of This Talk Share our discoveries Document all of our steps Fun! What is Instruments? Instruments

More information

Advanced Memory Analysis with Instruments. Daniel Delwood Performance Tools Engineer

Advanced Memory Analysis with Instruments. Daniel Delwood Performance Tools Engineer Advanced Memory Analysis with Instruments Daniel Delwood Performance Tools Engineer 2 Memory Analysis What s the issue? Memory is critical to performance Limited resource Especially on iphone OS 3 4 Memory

More information

Computer Science, a Mac, and You. Kevin Cathey Junior, Computer Science

Computer Science, a Mac, and You. Kevin Cathey Junior, Computer Science Computer Science, a Mac, and You Kevin Cathey Junior, Computer Science Roadmap Introduction to Apple s Developer Tools Xcode & Instruments Implement three MP s acm.uiuc.edu Introduction to Developer Tools

More information

Developing Applications for ios

Developing Applications for ios Developing Applications for ios Lecture 10: and Categories Radu Ionescu raducu.ionescu@gmail.com Faculty of Mathematics and Computer Science University of Bucharest Content and Documents This is how you

More information

COMP327 Mobile Computing Session: Tutorial Objective-C and the Foundation Framework

COMP327 Mobile Computing Session: Tutorial Objective-C and the Foundation Framework COMP327 Mobile Computing Session: 2010-2011 Tutorial 4-5 - Objective-C and the Foundation Framework 1 In these Tutorial Slides... These slides introduce you to Objective-C, with a focus on the object-oriented

More information

E Event-based parser, XML, 180 Extended attributes, URLs, 118 API, 119 command line, 118 description, 118 NSURL category, 119

E Event-based parser, XML, 180 Extended attributes, URLs, 118 API, 119 command line, 118 description, 118 NSURL category, 119 Index A Access control lists (ACLs), 113 Application distribution, 353 certificate utility, 358 App ID creation, 358 App Store, 363 center, 357 no of certificates, 358 code sign identity, 362 configuring

More information

Extensibility in GNUstep & Étoilé

Extensibility in GNUstep & Étoilé Extensibility in GNUstep & Étoilé GNU Hackers 2011 http://www.gnustep.org http://www.etoileos.com Objective-C & GNUstep Objective-C Created by Brad Cox and Tom Love in 1986 to package C libraries in Smalltalk-like

More information

CS193E Lecture 14. Cocoa Bindings

CS193E Lecture 14. Cocoa Bindings CS193E Lecture 14 Cocoa Bindings Agenda Questions? Personal Timeline IV Key Value Coding Key Value Observing Key Value Binding Cocoa Bindings What are Cocoa Bindings? Added in Panther, more mature in Tiger

More information

Mobile Application Development

Mobile Application Development Mobile Application Development Lecture 13 Introduction to ObjectiveC Part II 2013/2014 Parma Università degli Studi di Parma Lecture Summary Object creation Memory management Automatic Reference Counting

More information

Object-Oriented Programming with Objective-C. Lecture 2

Object-Oriented Programming with Objective-C. Lecture 2 Object-Oriented Programming with Objective-C Lecture 2 Objective-C A Little History Originally designed in the 1980s as a fusion of Smalltalk and C Popularized by NeXTSTEP in 1988 (hence the ubiquitous

More information

CLOCK TUTORIAL VERY SIMPLE HELLO WORLD COCOA APPLICATION

CLOCK TUTORIAL VERY SIMPLE HELLO WORLD COCOA APPLICATION http:clanmills.com Page 1/10 CLOCK TUTORIAL VERY SIMPLE HELLO WORLD COCOA APPLICATION Life in a new programming environment has to start somewhere. Everybody knows the hello world application written in

More information

Multitasking and Background Execution

Multitasking and Background Execution Multitasking and Background Execution Fall, 2012 Prof. Massimiliano "Max" Pala pala@nyu.edu Introduction Spawning Threads and Tasks Background Execution User hits 'home' button the app is sent in the background

More information

NSObject. - (NSString *)description Provides us with a string description of the object

NSObject. - (NSString *)description Provides us with a string description of the object FoundationFramework NSObject - (NSString *)description Provides us with a string description of the object NSString - (NSString *)stringbyappendingstring:(nsstring *)string Creates a new string by adding

More information

Stanford CS193p. Developing Applications for ios Fall Stanford CS193p. Fall 2013

Stanford CS193p. Developing Applications for ios Fall Stanford CS193p. Fall 2013 Developing Applications for ios -14 Today What is this class all about? Description Prerequisites Homework / Final Project ios Overview What s in ios? MVC Object-Oriented Design Concept Objective C (Time

More information

About MSDOSX. Lecture 0

About MSDOSX. Lecture 0 About MSDOSX Lecture 0 Goal: make an app of your own design for the Mac or iphone The Plan Lectures + Labs for several weeks Project proposals (about halfway through the semester) Work on project Present

More information

AVAudioPlayer. avtouch Application

AVAudioPlayer. avtouch Application AVAudioPlayer avtouch Application iphone Application Index 1. iphone Application 1) iphone Application 2) iphone Application Main Method 3) iphone Application nib(.xib) 2. avtouch Application 1) avtouch

More information

1.The basics 5 Comments 5 Variables and basic types 6 Operators 8 Object variables 10 A note on prefixes and namespaces 11

1.The basics 5 Comments 5 Variables and basic types 6 Operators 8 Object variables 10 A note on prefixes and namespaces 11 1.The basics 5 Comments 5 Variables and basic types 6 Operators 8 Object variables 10 A note on prefixes and namespaces 11 2.Branching and decisions 12 If-else statement 12 Switch statement 13 Ternary

More information

Introductory ios Development

Introductory ios Development Introductory ios Development 152-164 Unit 2 - Basic Objective-C Syntax Quick Links & Text References Console Application Pages Running Console App Pages Basic Syntax Pages Variables & Types Pages Sequential

More information

Using Swift with Cocoa and Objective-C

Using Swift with Cocoa and Objective-C Using Swift with Cocoa and Objective-C Contents Getting Started 5 Basic Setup 6 Setting Up Your Swift Environment 6 Understanding the Swift Import Process 7 Interoperability 9 Interacting with Objective-C

More information

ITP 342 Mobile App Dev. Fundamentals

ITP 342 Mobile App Dev. Fundamentals ITP 342 Mobile App Dev Fundamentals Object-oriented Programming Object-oriented programming (OOP) is a programming paradigm based on the concept of objects. Classes A class can have attributes & actions

More information

Core Animation. Building Animated UI s. Bill Dudney. Gala Factory Software LLC. Bill Dudney Core Animation: Building Animated UI s Slide 1

Core Animation. Building Animated UI s. Bill Dudney. Gala Factory Software LLC. Bill Dudney Core Animation: Building Animated UI s Slide 1 Core Animation Building Animated UI s Bill Dudney Gala Factory Software LLC Bill Dudney Core Animation: Building Animated UI s Slide 1 Objective-C Dynamic Object Oriented C Based Smalltalk Roots Bill Dudney

More information

Topics in Mobile Computing

Topics in Mobile Computing Topics in Mobile Computing Workshop 1I - ios Fundamental Prepared by Y.H. KWOK What is ios? From Wikipedia (http://en.wikipedia.org/wiki/ios): ios is an operating system for iphone, ipad and Apple TV.

More information

Getting Help. iphone Application Programming Lecture 3: Foundation Classes. Data Structures in Objective C. Online Documentation.

Getting Help. iphone Application Programming Lecture 3: Foundation Classes. Data Structures in Objective C. Online Documentation. iphone Application Programming Lecture 3: Foundation Classes Prof. Jan Borchers Media Computing Group RWTH Aachen University Winter Semester 2013/2014 http://hci.rwth-aachen.de/iphone Online Documentation

More information

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. Contents at a Glance About the Author...

More information

iphone Application Programming Lecture 3: Foundation Classes

iphone Application Programming Lecture 3: Foundation Classes iphone Application Programming Lecture 3: Foundation Classes Prof. Jan Borchers Media Computing Group RWTH Aachen University Winter Semester 2013/2014 http://hci.rwth-aachen.de/iphone Getting Help Online

More information

Intro to Native ios Development. Dave Koziol Arbormoon Software, Inc.

Intro to Native ios Development. Dave Koziol Arbormoon Software, Inc. Intro to Native ios Development Dave Koziol Arbormoon Software, Inc. About Me Long time Apple Developer (20 WWDCs) Organizer Ann Arbor CocoaHeads President & ios Developer at Arbormoon Software Inc. Wunder

More information

CS193P - Lecture 2. iphone Application Development. Objective-C Foundation Framework

CS193P - Lecture 2. iphone Application Development. Objective-C Foundation Framework CS193P - Lecture 2 iphone Application Development Objective-C Foundation Framework Announcements Enrollment process is complete! Contact cs193p@cs.stanford.edu if you are unsure of your status Please drop

More information

CLOCK4 TUTORIAL VERY SIMPLE HELLO WORLD COCOA APPLICATION

CLOCK4 TUTORIAL VERY SIMPLE HELLO WORLD COCOA APPLICATION http:clanmills.com Page 1/8 CLOCK4 TUTORIAL VERY SIMPLE HELLO WORLD COCOA APPLICATION Life in a new programming environment has to start somewhere. Everybody knows the hello world application written in

More information

ReactiveCocoa. Marc Prud'hommeaux Ottawa CocoaHeads February 13th, 2014

ReactiveCocoa. Marc Prud'hommeaux Ottawa CocoaHeads February 13th, 2014 ReactiveCocoa Marc Prud'hommeaux Ottawa CocoaHeads February 13th, 2014 Introduction ReactiveCocoa Functional Reactive Programming Open-source library by Josh Abernathy & Justin Spahr-Summers

More information

Accustoming Yourself to Objective-C

Accustoming Yourself to Objective-C 1 Accustoming Yourself to Objective-C Objective-C brings object-oriented features to C through an entirely new syntax. Often described as verbose, Objective-C syntax makes use of a lot of square brackets

More information

ITP 342 Mobile App Dev

ITP 342 Mobile App Dev ITP 342 Mobile App Dev Grand Central Dispatch Background Processing Grand Central Dispatch (GCD) New API for splitting up the work your app needs to do into smaller chunks that can be spread across multiple

More information

Cocoa > Objective-C Language

Cocoa > Objective-C Language The Objective-C 2.0 Programming Language Cocoa > Objective-C Language 2008-10-15 Apple Inc. 2008 Apple Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system,

More information

Stanford CS193p. Developing Applications for ios. Fall Stanford CS193p. Fall 2011

Stanford CS193p. Developing Applications for ios. Fall Stanford CS193p. Fall 2011 Developing Applications for ios Today Core Data and Documents This is how you store something serious in ios Easy entreé into icloud NSNotificationCenter The little radio station we talked about in the

More information

Finding Bugs Using Xcode Runtime Tools

Finding Bugs Using Xcode Runtime Tools Session Developer Tools #WWDC17 Finding Bugs Using Xcode Runtime Tools 406 Kuba Mracek, Program Analysis Engineer Vedant Kumar, Compiler Engineer 2017 Apple Inc. All rights reserved. Redistribution or

More information

CS193P - Lecture 10. iphone Application Development. Performance

CS193P - Lecture 10. iphone Application Development. Performance CS193P - Lecture 10 iphone Application Development Performance 1 Announcements 2 Announcements Paparazzi 2 is due next Wednesday at 11:59pm 2 Announcements Paparazzi 2 is due next Wednesday at 11:59pm

More information

Announcements. Today s Topics

Announcements. Today s Topics Announcements We will discuss final project ideas on Monday Three guest presenters coming to class Lab 5 is due on Wednesday Nov 4 th 1 Extensible - CSE 436 Software Networking Engineering Platform Workshop

More information

Stanford CS193p. Developing Applications for ios. Spring Stanford CS193p. Spring 2012

Stanford CS193p. Developing Applications for ios. Spring Stanford CS193p. Spring 2012 Developing Applications for ios Today Blocks Objective-C language feature for in-lining blocks of code Foundation of multi-threaded support (GCD) What is a block? A block of code (i.e. a sequence of statements

More information

ITP 342 Mobile App Dev. Animation

ITP 342 Mobile App Dev. Animation ITP 342 Mobile App Dev Animation Core Animation Introduced in Mac OS X Leopard Uses animatable "layers" built on OpenGL UIKit supports Core Animation out of the box Every UIView has a CALayer behind it

More information

Stanford CS193p. Developing Applications for iphone 4, ipod Touch, & ipad Fall Stanford CS193p Fall 2010

Stanford CS193p. Developing Applications for iphone 4, ipod Touch, & ipad Fall Stanford CS193p Fall 2010 Developing Applications for iphone 4, ipod Touch, & ipad Today Blocks Language syntax for declaring a function on the fly. Grand Central Dispatch C API for leveraging blocks to make writing multithreaded

More information

ios Mobile Development

ios Mobile Development ios Mobile Development Today Protocols How to make id a little bit safer. Blocks Passing a block of code as an argument to a method. Animation Dynamic Animator View property animation Demo Dropit! Protocols

More information

Monday, 1 November The ios System

Monday, 1 November The ios System The ios System System Overview System Overview System Overview System Overview System Overview System Overview Foundation Classes (Useful) Foundation Framework Value and collection classes User defaults

More information

This reference will take you through simple and practical approach while learning Objective-C Programming language.

This reference will take you through simple and practical approach while learning Objective-C Programming language. About the Tutorial Objective-C is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. This is the main programming language used by

More information

SWIFT! init(title: String) { self.title = title } // required initializer w/ named parameter

SWIFT! init(title: String) { self.title = title } // required initializer w/ named parameter SWIFT! class Session { let title: String // constant non-optional field: can never be null and can never be changed var instruktør: Person? // variable optional field: null is permitted var attendees:

More information

O(1) objectatindex: firstobject: lastobject: addobject: removelastobject: O(log n) indexofobject:insortedrange:options:usingcomp arator:

O(1) objectatindex: firstobject: lastobject: addobject: removelastobject: O(log n) indexofobject:insortedrange:options:usingcomp arator: ios - O(n) containsobject: indexofobject* removeobject: O(1) objectatindex: firstobject: lastobject: addobject: removelastobject: O(log n) indexofobject:insortedrange:options:usingcomp arator: Dictionary

More information

Objective-C. Deck.m. Deck.h. Let s look at another class. This one represents a deck of cards. #import <Foundation/Foundation.h> #import "Deck.

Objective-C. Deck.m. Deck.h. Let s look at another class. This one represents a deck of cards. #import <Foundation/Foundation.h> #import Deck. Deck.h #import @interface Deck : NSObject @interface Deck() @implementation Deck Deck.m Let s look at another class. This one represents a deck of cards. Deck.h #import

More information

iphone OS Overview

iphone OS Overview Founda'on Framework iphone OS Overview iphone OS Overview iphone OS Overview iphone OS Overview iphone OS Overview iphone OS Overview iphone Development Environment Cocoa in the architecture of ios Cocoa

More information

Introductory ios Development

Introductory ios Development Instructor s Introductory ios Development Unit 3 - Objective-C Classes Introductory ios Development 152-164 Unit 3 - Swift Classes Quick Links & Text References Structs vs. Classes Structs intended for

More information

X Review. Mac OS X Roots: NeXT. BWS Available for virtually every OS

X Review. Mac OS X Roots: NeXT. BWS Available for virtually every OS X Review Distributed window system Server is the user s Terminal Client runs the application WM Xlib Application Widget Set Xt Intrinsics Xlib Highly modular X Server (exchange WM, Widget Set) BWS Available

More information

Getting Help. iphone Application Programming Lecture 3: Foundation Classes. Data Structures in Objective C. Online Documentation.

Getting Help. iphone Application Programming Lecture 3: Foundation Classes. Data Structures in Objective C. Online Documentation. iphone Application Programming Lecture 3: Foundation Classes Prof. Jan Borchers Media Computing Group RWTH Aachen University Winter Semester 2013/2014 http://hci.rwth-aachen.de/iphone Online Documentation

More information

Announcements. Today s Topics

Announcements. Today s Topics Announcements Discuss Final Project Ideas on Wednesday Final Project teams will consist of 3 4 people No teams of 1 or 2 people Extensible Networking Platform 1 1 - CSE 438 Mobile Application Development

More information

When we re first learning Cocoa (or Java, or Qt, or any other application framework),

When we re first learning Cocoa (or Java, or Qt, or any other application framework), MacDevCenter http://www.macdevcenter.com/lpt/a/4752 6 April 2004 The Cocoa Controller Layer by Michael Beam When we re first learning Cocoa (or Java, or Qt, or any other application framework), one of

More information

Accessibility on ios. Developing for everyone. Frameworks #WWDC14. Session 210 Clare Kasemset ios Accessibility

Accessibility on ios. Developing for everyone. Frameworks #WWDC14. Session 210 Clare Kasemset ios Accessibility Frameworks #WWDC14 Accessibility on ios Developing for everyone Session 210 Clare Kasemset ios Accessibility 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without

More information

GNUstep: What is it? gnustep.org

GNUstep: What is it? gnustep.org GNUSTEP GNUstep: What is it? A powerful object-oriented development environment: A set of cross-platform libraries for developing applications (text, graphic, script, web, etc.) Development tools and applications

More information

Porting Objective-C to Swift. Richard Ekle

Porting Objective-C to Swift. Richard Ekle Porting Objective-C to Swift Richard Ekle rick@ekle.org Why do we need this? 1.2 million apps in the ios App Store http://www.statista.com/statistics/276623/numberof-apps-available-in-leading-app-stores/

More information

Jython. An introduction by Thinh Le

Jython. An introduction by Thinh Le Jython An introduction by Thinh Le precursor_python! Google App Engine! Dropbox! PyGTK (Gnome)! Vim (embedded)! BitTorrent/Morpheus! Civilization/Battlefield Jython! Interpretation of Python (1997)! Jim

More information