the roads to friendship

32
Hello

Upload: acvivo

Post on 14-Jun-2015

351 views

Category:

Presentations & Public Speaking


0 download

DESCRIPTION

Presentation about the ways to make iOS apps good citizens by implementing Inter-app communication.

TRANSCRIPT

Page 1: The roads to friendship

Hello

Page 2: The roads to friendship

Who$am$I?• Antonio'Cabezuelo'Vivo

• Freelance'iOS'developer'since'2008.

• Camera+,'Kiosko.net,'FunBox,'and'many'others.

Page 3: The roads to friendship

The$roads$to$friendship

Page 4: The roads to friendship

The$roads$to$friendshipmaking'your'apps'be0er'ci2zens'using'Inter6app'communica2on

Page 5: The roads to friendship

What%is%Inter,app%communica2on?

“Is$the$process$by$which$two$apps$in$the$same$device$talk$to$each$other$to$share$data$or$to$perform$ac8ons$relevant$to$the$context$of$

both$apps.”

—"me

Page 6: The roads to friendship

Friendship*ways• Family(ma)ers

• Lendings

• Smart(friends

• Fluent(conversa8ons

Page 7: The roads to friendship

Family• Apps%from%the%same%developer

• Use%a%shared'keychain1

• Use%an%app%group%NSUserDefaults-initWithSuiteName:

1"Example"at"h,p://shaune.com.au/ios6keychain6sharing6data6between6apps/

Page 8: The roads to friendship

Lending• Apps%that%send/receive%data%to/from%other%apps

• Mul7ple%ways

• Via%"Open&in…"

• Via%Document&Provider%extensions

• Custom%URL&schemes%using%UIPasteboard

• Via%AppLinks

Page 9: The roads to friendship

"Open&in…"• Allows'to'send/receive'files'to/from'other'apps.

• Use'UIActivityViewController'to'send.

• Set'CFBundleDocumentTypes'in'Info.plist'to'support'receiving'files

• Test'for'file:'url'scheme'in'UIApplica>onDelegate'method'

.applica1on:openURL:sourceApplica1on:annota1on:

Page 10: The roads to friendship

Document)Provider• Allows'other'apps'to'access'the'documents'managed'by'your'app.

• Allows'your'app'to'access'documents'from'other'apps

• Accessed'by'any'app'using'a'UIDocumentPickerViewController

• Example'at'http://www.macstories.net/tutorials/implementing-ios-8-document-pickers/

Page 11: The roads to friendship

Custom'URL'schemes2

• Every'app'can'add'support'for'mul$ple'custom'url'schemes.

• Configured'in'Info.plist'inside'URL*Types'sec:on

• To'launch'the'other'app'use:[[UIApplication sharedApplication] openURL:url];

• Send'data'via'url'parameters'or'UIPasteboard

2"h$p://handleopenurl.com

Page 12: The roads to friendship

UIPasteboard

• Create'a'private'UIPasteboard

• Make'it'persistent

• Add,data'to'pasteboard'0ed'to'a'UTI

• Launch'friend'app'via'custom,URL,scheme'indica0ng'pasteboard'name

• Read,data'from'pasteboard'inside'friend'app

Page 13: The roads to friendship

AppLinks3

• Cross&pla*orm,-open-source,-and-simple-mobile-deep&linking.

• A-way-to-link-app-content-from-outside-the-app.

• Promoted-by-Facebook

• Reference-implementaAon-in-Bolts4

4"h$ps://github.com/BoltsFramework/Bolts:iOS

3"h$p://applinks.org/documenta8on/

Page 14: The roads to friendship

The$smart$friends

Offer%custom%func.onality%to%other%apps.

• Via%extensions

• Audio%apps%can%use%Inter*app-audio5%or%Audiobus6

6"h$p://audiob.us

5"h$ps://developer.apple.com/library/ios/samplecode/InterAppAudioSuite/Introduc<on/Intro.html

Page 15: The roads to friendship

Ac#on&extensions• Allows'ac*ons'to'be'applied'to'different'content

• Through'UIActivityViewController

• Can'have'custom'UI'or'not.

Page 16: The roads to friendship

Photo%extensions

• Allows'edi+ng'photos'inside'Photos.app'

• Can'only'be'one'for'each'type'(photo,'video)'in'a'containing'app.

• Photos.app'provides'original+adjustments'or'current'version'

• Must'support'both'device'orienta,ons

Page 17: The roads to friendship

Fluent'conversa.ons

Apps$communicate$back&forth$using$URLs$with$custom$URL$schemes.

• Both&apps&must&know&the&protocol&used.

• Be5er&using&x"callback"url

• Much&be5er&and&easier&using&the&IAC-framework

Page 18: The roads to friendship

x"callback"url7

Provide(a(standardized(means(for(iOS(developers(to(expose(and(document(the(methods(they(make(available(to(other(apps

URL$Structure

[scheme]://x-callback-url/[action]?[x-callback parameters]&[action parameters]

7"h$p://x)callback)url.com."Directory"at"h$p://philgr.com/library"

Page 19: The roads to friendship

x"callback(parameters

• x"source"The"friendly"name"of"the"source"app"calling"the"ac6on

• x"success"URL"to"open"to"return"to"the"source"app"on"success

• x"error"URL"to"open"to"return"to"the"source"app"on"error

• x"cancel"URL"to"open"to"return"to"the"source"app"on"cancel

Page 20: The roads to friendship

IAC$Framework

The$easiest$way$to$add$x"callback"url$support$to$your$app.

• Forget(about(parsing(complicated(URLs

• Use(Objec9ve;C(classes(with(callback(blocks

• Create(custom(classes(for(integra9ng(in(other(apps

h"ps://github.com/tapsandswipes/InterAppCommunica9on

Page 21: The roads to friendship

Example

Adding&a&url&to&Instapaper&from&your&app.

Without'IAC

NSString *instapaperURL = [NSString stringWithFormat:@"x-callback-instapaper://x-callback-url/add?url=%@", [@"http://tapsandswipes.com" urlEncodedString];

NSUrl *url = [NSUrl urlWithString:instapaperURL];

if ([[UIApplication sharedApplication] canOpenURL:url]) { [UIApplication sharedApplication] openURL:url];}

Page 22: The roads to friendship

With%IAC

[[InstapaperIACClient client] add:@"http://tapsandswipes.com"];

Page 23: The roads to friendship

DEMO

Page 24: The roads to friendship

"Other"!waysThere%are%ways%to%be%friendship%not%accepted%by%the%Mother'Ship

• Via%reminders

• Via%custom,contact%in%address%book

Page 25: The roads to friendship

The$future$of$friendship(specula)ons)

• Open&Extensions&to&other&document&types&and&apps

• Standarize&x7callback7url&through&custom&interfaces

• Two&apps&on&screen&communica?ng&via&standard&APIs

Page 26: The roads to friendship

Conclusions

Page 27: The roads to friendship

Should'my'app'be'friendly?YES

“The%only%way%to%have%a%friend%is%to%be%one”

—"not"me

Page 28: The roads to friendship

Should'my'app'be'friendly?YES

“The%only%way%to%have%a%friend%is%to%be%one”

—"Ralph"Waldo"Emerson

Page 29: The roads to friendship

Why?• Makes'your'app'be.er.

• Adds'more'uses'to'your'app.

• Helps'other'apps'to'be'be.er.

Page 30: The roads to friendship

Don’t&forget&to&always&add

CommonSense.frameworkto#all#your#projects

Page 31: The roads to friendship

Thank&you

Page 32: The roads to friendship

Contact'info

Twi$er:(@acvivo

e"mail:([email protected]

web:%h"p://tapsandswipes.com

Github:(h"p://github.com/tapsandswipes