Apidays New York 2024 - The value of a flexible API Management solution for O...
Tulsa Dev Lunch iOS at Work
1. iOS at Work:
Integrating iOS Apps with
Back End Systems
Tulsa Dev Lunch
February 13, 20
1 3
Mat llowaoydinaire)
t Ga a r
obile Develo per Extr
(Fr eelance M
Wednesday, February 13, 13
2. h at a bo ut
W d?
A n dr oi
Wednesday, February 13, 13
3. Android s
ucks.
(Espec ially for business.)
Wednesday, February 13, 13
4. Most Consistent API
Consistent Hcxrdwcxre
--
Best Securit.Y
1=eel G-ood Kumb·,cx Pseudo Open
Source-ness
Wednesday, February 13, 13
5. aid, most of what I’m gonna say a bout iOS applies to Android too.
That s Meh.
Wednesday, February 13, 13
6. Th ink m obile!
Th ink n ow!
Wednesday, February 13, 13
7. Ch aracteristi cs of Mobile
not a keyboard /mouse paradigm
small screen
unreliable low bandwidth high latency network connection
ocessing power a nd local storage
limited pr
limited battery life
hostile work environment
untapped resources: camera(s), acceler
ometers,
GPS, phone, speaker, mic, LED flash
Wednesday, February 13, 13
9. Mo bile w eb or die.
Wednesday, February 13, 13
10. Natrve (iOS, Android,
Blackberry, Windows
Phone) App Window
Flll~dwith a single
Awesome Dashboard We.bVIeW widget loaded
"App" With your mobile web
content.
Awesome Dashboard
"App"
Wednesday, February 13, 13
12. When the web wo n’t do.
Performance/Responsiveness/UX.
Complex lo cal data store.
Ne twork optional.
Hardware control.
Sophisticated UI.
3D/a ccelerated graphics.
Wednesday, February 13, 13
13. re ent erprise mobile
How a
ap ps diff erent?
Complex local data st
res. o
I ntegration wi th back office
systems.
Wednesday, February 13, 13
14. ,..__---------~----~~
Mob.1le Inte_gr~t:1on J>os &- J>on'ts
,
OV 0
Cove-r -the Yet) I
I
I
I
I
I
Crf ~oLA he>.ve -t:.o) /
I
I
I
I
I
I
I
I
f>ov-ts B$Z> &-443 I
I
I
I
Wednesday, February 13, 13
15. Protot_yp·,ccxrash
EVterpr·,se Arch.atecture
""'
-+l
-
.a...
~
•
H o
(/)
(J
;.J
<U
H
~ LU""
' •
H
~ LU""
' (J
•
:J >l-...
cS <(_ LU-tJ
(J
<(_ LU-tJ
<Sw
hZ. -:s ~ (U -:s ~ (U
sG.'-
_g ""'~ 4- h '"" 4- h '""
cu(/)V) r- '""~ r- '""~
r-~ r-~
3~~ (/) (/)
""Q_. LU LU<!. LU LU<!.
_J (/) p!. z~ p!. z~
•
. ~h •
l-
I. D~t~
Stov-e
Bus·aness D~t~
Present~ t·aon Access
Lo.9·ac
Wednesday, February 13, 13
19. Discl aimer : I’m
not .NET devel oper,
bu tIe xper iment ed a
little in co llege.
Wednesday, February 13, 13
20. In Vis ual St udio...
1.) Create a Web Project
a new Entity Model
2.) Create
3.) Reverse enginee r Entity Model
from Database
reate a WCF Dat a Service o
4.) C odel Cl ass t
Add y our En tity M
5.) ration
decla .
class cess
the S ervice a ac
onf igure dat
6.) C
Wednesday, February 13, 13
21. [JSONPSupportBehavior]
public class Service : DataService<YourEnterpriseEntities>
{
// This method is called only once to initialize service-wide policies.
public static void InitializeService(DataServiceConfiguration config)
{
// config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
config.SetEntitySetAccessRule("Locations", EntitySetRights.AllRead);
config.SetEntitySetAccessRule("Customers", EntitySetRights.All);
config.SetEntitySetAccessRule("SalesOrders", EntitySetRights.All);
config.SetEntitySetAccessRule("Secrets", EntitySetRights.None);
//Set a reasonable paging site
config.SetEntitySetPageSize("*", 25);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}
}
Source:
http://www.hanselman.com/blog/CreatingAnODataAPIForStackOverflowIncludingXMLAndJSONIn30Minutes.aspx
Wednesday, February 13, 13
28. id retVal = [interimDict objectForKey:@"d"];
if ([retVal isKindOfClass:[NSDictionary class]] && [((NSDictionary *)retVal) objectForKey:@"results"]!=nil) {
return [((NSDictionary *)retVal) objectForKey:@"results"];
} else {
return retVal;
}
} else {
NSLog(@"Error: unable to complete web request because - %@",[internalError localizedDescription]);
if (error!=nil) *error=internalError;
return nil;
}
NSArray
}
If result is a list, an
NSMutab leDiction ary’s is
of
ret urned.
Otherwise, an
NSMutableDictionary
is returned.
Wednesday, February 13, 13
31. What to Do With an NSMutableDictionary?
1.) Parse into proper objects
2.) Create a wrapper object that
stores NSMutableDictionary internally
3.) Use Objective-C Categories to add
field-like methods to NSMutableDictionary
But don’t just
[object objectForKey: @“propertyName“]
Wednesday, February 13, 13
32. //
// NSMutableDictionary+Customer.m
// Yale Cleaners
//
// Created by Matt Galloway on 8/31/12.
// Copyright (c) 2012 Architactile LLC. All rights reserved.
//
#import "NSMutableDictionary+Customer.h"
@implementation NSMutableDictionary (Customer)
#pragma mark - Customer Custom Getters
-(NSString *) mobileNumber {
ple
return [self filteredObjectForKey:@"Mobile_no"];
}
am
-(NSString *) sendEmail {
return [self filteredObjectForKey:@"SendEmail"];
}
Ex
-(NSString *) sendReceipt {
return [self filteredObjectForKey:@"SendReceipt"];
}
ry
-(NSString *) sendText {
return [self filteredObjectForKey:@"SendText"];
}
ego
-(NSString *) username {
return [self filteredObjectForKey:@"User_Name"];
}
t
-(NSString *) uri {
return [self filteredObjectForKey:@"uri"];
Ca
}
-(NSString *) address {
return [self filteredObjectForKey:@"address"];
-(NSString *) area {
return [self filteredObjectForKey:@"area"];
}
-(NSString *) charge {
return [self filteredObjectForKey:@"charge"];
}
-(NSString *) city {
return [self filteredObjectForKey:@"city"];
}
.
.
.
Wednesday, February 13, 13
33. Use HTT PS +
Au then tica tion
(at a mini mum)
Wednesday, February 13, 13
34. Loca l Data Store?
M eet SQ Lite &
Cor eData
Wednesday, February 13, 13
35. ata is one of iOS’s
CoreD
greate st adv antag es over
d for b usiness apps.
Androi
Wednesday, February 13, 13
36. PrtmaryK _y _--1
_e;_ • Anr butt~
hc: dlypc: Louuonvet.lO.lt.l-,
-
C Locat o n _----,~
_o _
_
JSOnW~t~Od i fied Annb~o~tcs 1 Auro butes
9
loatoorMet~DJ.tJfield ld jsonlilstY.od I fled OJddrusl
,~e ocatton~ctOJDiltald .lddreu2
pockl stCho ces vo~lu tBool City
required v.llu eno~t folde r' arne
• Rclattons hips VJ.Iuelnt htghCr. mc:Locat.on
J S.onuu~od o ticd
location~c:tt~Oata < valueText
-
Rc ta11onsh1ps loutoOf'lld
!ocatton loutlonN u mber
.;
Pr OJeCt l'ame
• Attll bU IC!S state
folderNam e ~urveyCiodT me
j sonl.ast'li~ocM1ed surveyor
name: sutleySct'leduled-IIM
proJectld
syn<Corn !)lete
Re ~l i O nships
draw-ng-ypes
elementRe qul rements
:~:~::~:d~~
syt'I(Complete
2op
cotNple-Le
I J ' ~
fc:: Re :lto hlps
ons
>dto'lwings Elemc:ntRc:qu rc:rrc:f'll
1 0r.Jwingiy____1
JX
D•aw r.g
• Attribute~ ·--..-j~----+ locattonl'etaOata
~
::__j
e eme t~tRequi remc:nu Anro butes
e ementRequirementld
Attributes
dr.w,, ngTypeld
1---------
drolw n!lld
fa en~rne
project JSOt'll...lStMOCifled
m.lXAllcw.ed
JSO nl...lstMOOif1ed m nRc:qu•rcd
name heo tgh Relauonsho ps
Re atton~h ps JSOf'll.astMod•f1ed , . - - - - + - - - - - - - - - --1-- ,..> drav. n!jType
dril'Wi ngs A::llamc: i---1-~---+----------+--+~c: cmc:ntTypc
OementTyoe
c:o
--:
c:mc:ntRcquirc:mcnts
c c:mentType5
!---t-~PI'OJ ects _ _ _ ___,.J
scale
wlctth
Re ·" •onship~
d t.lWlngTypt
1,..:::::1
l ===------:!-------------lL...--~~~ocatoon
:=
~
" d ----'
E ementCroup
• Ann b"tc:s
elementGroupld
9 Annblltes
c:lememTypeld
,conl tlename eemenu _
1_
, ~ t.~ ~ cc
l1.J
JsonLut'-1oct'lc:d Jsonl..ut'Aocif,c:d
n;amc:
sortOrde r
Rel.'lt on·"s~"'c;===i
" h t ps
narrc:
Rc: o'!t onhops
drilv.ongTypu Element ess
er w h
/'.,.» elementCroup AUt ib'->ttS
dra~o, ng(()Q(dX
c:lementQ..estlons
c:lementRequ lremen ts
~;::·~~;=~:n V ·,t.
lm0 t.
c:lc:mc:nts
elementld
~
clcmentll.umber
jsonl..ut'-1oditied
Eltmc:ntQue stlon
~
Attrobutes
c: c:mc:ntQI.esbonld
~~
n.1me
'f Relat o n Sh pS
O
s
no
nelpPnotofoename !-------c:iementAnswc:rs
help-tltt
nchesMax
Code ~nd
nches4ln
json~tlod • tied E c:mentAnswc:r 0 emc ntA.11s"'..: rPhoto
pnoto.AI owNOt e~
J
Auro butes Aur iba.tes
:>hotoM.1xCount OJnswc: rlnt crc;atcdOn
ohotoM nCount
photoRc:qu rel'l.otcs
p cl(L siC no cc:s
quest Of'ITtxt
.'lnswerText
created On
e emen!An~"erld
etementAnswerPhotold
gpsUto tude
gpslottgltude
no
SQL•
gpslatttudc: t'ludong
quest on- 'fpe gpslong tude jsonLOJst'Aodoficd
required jsonLmVoct o foed .'lnMod fied
sortOrdc:r IJ.stl'-'od ned ~otor den~e
tc:xtMaxleng th Re ilto ons"'lps photoNotts
Rc: ilto
oqhips e ement
: :::~~~;~;:rs "< _-------------------,fmentAn~"-C!rPhotos
; +u
Wednesday, February 13, 13
37. To Re cap...
A ndroid sucks.
Mobilize your web assets.
he mob ile web first.
Con sider t
Avoid SQL & SOAP.
Use RESTful APIs.
Co reData i s way w orth it.
Wednesday, February 13, 13
38. Mat llowaoydinaire)
t Ga a r
o bile Develo per Extr
(Fre elance M
matt@architactile.c
om
918 -808- 3072
Wednesday, February 13, 13