Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
f4c26ae4
Commit
f4c26ae4
authored
Nov 10, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import AFNetworking Mac Example and update it to use CocoaPods.
parent
b3761cfa
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
550 additions
and
13 deletions
+550
-13
project.pbxproj
...xample/AFNetworking Mac Example.xcodeproj/project.pbxproj
+0
-0
contents.xcworkspacedata
...tworking Mac Example.xcworkspace/contents.xcworkspacedata
+10
-0
AppDelegate.h
examples/AFNetworking Mac Example/AppDelegate.h
+32
-0
AppDelegate.m
examples/AFNetworking Mac Example/AppDelegate.m
+33
-0
AFGowallaAPIClient.h
...les/AFNetworking Mac Example/Classes/AFGowallaAPIClient.h
+31
-0
AFGowallaAPIClient.m
...les/AFNetworking Mac Example/Classes/AFGowallaAPIClient.m
+64
-0
NearbySpotsController.h
...g Mac Example/Classes/Controllers/NearbySpotsController.h
+30
-0
NearbySpotsController.m
...g Mac Example/Classes/Controllers/NearbySpotsController.m
+124
-0
Spot.h
examples/AFNetworking Mac Example/Classes/Models/Spot.h
+43
-0
Spot.m
examples/AFNetworking Mac Example/Classes/Models/Spot.m
+76
-0
placeholder-stamp.png
...les/AFNetworking Mac Example/Images/placeholder-stamp.png
+0
-0
Info.plist
examples/AFNetworking Mac Example/Info.plist
+36
-0
Podfile
examples/AFNetworking Mac Example/Podfile
+19
-0
Prefix.pch
examples/AFNetworking Mac Example/Prefix.pch
+7
-0
Credits.rtf
examples/AFNetworking Mac Example/en.lproj/Credits.rtf
+14
-0
MainMenu.xib
examples/AFNetworking Mac Example/en.lproj/MainMenu.xib
+0
-0
main.m
examples/AFNetworking Mac Example/main.m
+29
-0
Podfile
examples/AFNetworking iOS Example/Podfile
+2
-13
No files found.
examples/AFNetworking Mac Example/AFNetworking Mac Example.xcodeproj/project.pbxproj
0 → 100644
View file @
f4c26ae4
This diff is collapsed.
Click to expand it.
examples/AFNetworking Mac Example/AFNetworking Mac Example.xcworkspace/contents.xcworkspacedata
0 → 100644
View file @
f4c26ae4
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version =
"1.0"
>
<FileRef
location =
"group:Pods/Pods.xcodeproj"
>
</FileRef>
<FileRef
location =
"group:AFNetworking Mac Example.xcodeproj"
>
</FileRef>
</Workspace>
examples/AFNetworking Mac Example/AppDelegate.h
0 → 100644
View file @
f4c26ae4
// AppDelegate.h
//
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Cocoa/Cocoa.h>
@interface
AppDelegate
:
NSObject
<
NSApplicationDelegate
>
{
NSWindow
*
_window
;
}
@property
(
strong
)
IBOutlet
NSWindow
*
window
;
@end
examples/AFNetworking Mac Example/AppDelegate.m
0 → 100644
View file @
f4c26ae4
// AppDelegate.m
//
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "AppDelegate.h"
@implementation
AppDelegate
@synthesize
window
=
_window
;
-
(
void
)
applicationDidFinishLaunching
:(
NSNotification
*
)
aNotification
{
}
@end
examples/AFNetworking Mac Example/Classes/AFGowallaAPIClient.h
0 → 100644
View file @
f4c26ae4
// AFGowallaAPI.h
//
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "AFHTTPClient.h"
extern
NSString
*
const
kAFGowallaClientID
;
extern
NSString
*
const
kAFGowallaBaseURLString
;
@interface
AFGowallaAPIClient
:
AFHTTPClient
+
(
AFGowallaAPIClient
*
)
sharedClient
;
@end
examples/AFNetworking Mac Example/Classes/AFGowallaAPIClient.m
0 → 100644
View file @
f4c26ae4
// AFGowallaAPI.m
//
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "AFGowallaAPIClient.h"
#import "AFJSONRequestOperation.h"
// Replace this with your own API Key, available at http://api.gowalla.com/api/keys/
NSString
*
const
kAFGowallaClientID
=
@"e7ccb7d3d2414eb2af4663fc91eb2793"
;
NSString
*
const
kAFGowallaBaseURLString
=
@"https://api.gowalla.com/"
;
@implementation
AFGowallaAPIClient
+
(
AFGowallaAPIClient
*
)
sharedClient
{
static
AFGowallaAPIClient
*
_sharedClient
=
nil
;
static
dispatch_once_t
oncePredicate
;
dispatch_once
(
&
oncePredicate
,
^
{
_sharedClient
=
[[
self
alloc
]
initWithBaseURL
:[
NSURL
URLWithString
:
kAFGowallaBaseURLString
]];
});
return
_sharedClient
;
}
-
(
id
)
initWithBaseURL
:
(
NSURL
*
)
url
{
self
=
[
super
initWithBaseURL
:
url
];
if
(
!
self
)
{
return
nil
;
}
[
self
registerHTTPOperationClass
:[
AFJSONRequestOperation
class
]];
// Accept HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
[
self
setDefaultHeader
:
@"Accept"
value
:
@"application/json"
];
// X-Gowalla-API-Key HTTP Header; see http://api.gowalla.com/api/docs
[
self
setDefaultHeader
:
@"X-Gowalla-API-Key"
value
:
kAFGowallaClientID
];
// X-Gowalla-API-Version HTTP Header; see http://api.gowalla.com/api/docs
[
self
setDefaultHeader
:
@"X-Gowalla-API-Version"
value
:
@"1"
];
return
self
;
}
@end
examples/AFNetworking Mac Example/Classes/Controllers/NearbySpotsController.h
0 → 100644
View file @
f4c26ae4
// NearbySpotsViewController.h
//
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Cocoa/Cocoa.h>
#import <CoreLocation/CoreLocation.h>
@interface
NearbySpotsController
:
NSObject
<
CLLocationManagerDelegate
,
NSTableViewDataSource
,
NSTableViewDelegate
>
@property
(
strong
)
IBOutlet
NSTableView
*
tableView
;
@end
examples/AFNetworking Mac Example/Classes/Controllers/NearbySpotsController.m
0 → 100644
View file @
f4c26ae4
// NearbySpotsViewController.m
//
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "NearbySpotsController.h"
#import "Spot.h"
#import "AFImageRequestOperation.h"
#import "AFImageCache.h"
@interface
NearbySpotsController
()
@property
(
strong
)
NSArray
*
nearbySpots
;
@property
(
strong
)
CLLocationManager
*
locationManager
;
@property
(
strong
)
NSOperationQueue
*
imageOperationQueue
;
-
(
void
)
loadSpotsForLocation
:(
CLLocation
*
)
location
;
@end
@implementation
NearbySpotsController
@synthesize
nearbySpots
=
_nearbySpots
;
@synthesize
locationManager
=
_locationManager
;
@synthesize
imageOperationQueue
=
_imageOperationQueue
;
@synthesize
tableView
=
_tableView
;
-
(
id
)
init
{
self
=
[
super
init
];
if
(
!
self
)
{
return
nil
;
}
self
.
nearbySpots
=
[
NSArray
array
];
self
.
locationManager
=
[[
CLLocationManager
alloc
]
init
];
self
.
locationManager
.
delegate
=
self
;
self
.
locationManager
.
distanceFilter
=
80
.
0
;
self
.
imageOperationQueue
=
[[
NSOperationQueue
alloc
]
init
];
self
.
imageOperationQueue
.
maxConcurrentOperationCount
=
8
;
return
self
;
}
-
(
void
)
awakeFromNib
{
// Load from a fixed location, in case location services are disabled or unavailable
CLLocation
*
austin
=
[[
CLLocation
alloc
]
initWithLatitude
:
30
.
2669444
longitude
:
-
97
.
7427778
];
[
self
loadSpotsForLocation
:
austin
];
[
self
.
locationManager
startUpdatingLocation
];
}
-
(
void
)
loadSpotsForLocation
:
(
CLLocation
*
)
location
{
[
Spot
spotsWithURLString
:
@"/spots"
near
:
location
parameters
:
[
NSDictionary
dictionaryWithObject
:
@"128"
forKey
:
@"per_page"
]
block
:^
(
NSArray
*
records
)
{
self
.
nearbySpots
=
[
records
sortedArrayUsingComparator
:
^
NSComparisonResult
(
id
obj1
,
id
obj2
)
{
CLLocationDistance
d1
=
[[(
Spot
*
)
obj1
location
]
distanceFromLocation
:
location
];
CLLocationDistance
d2
=
[[(
Spot
*
)
obj2
location
]
distanceFromLocation
:
location
];
if
(
d1
<
d2
)
{
return
NSOrderedAscending
;
}
else
if
(
d1
>
d2
)
{
return
NSOrderedDescending
;
}
else
{
return
NSOrderedSame
;
}
}];
[
self
.
tableView
reloadData
];
}];
}
#pragma mark - CLLocationManagerDelegate
-
(
void
)
locationManager
:
(
CLLocationManager
*
)
manager
didUpdateToLocation
:
(
CLLocation
*
)
newLocation
fromLocation
:
(
CLLocation
*
)
oldLocation
{
[
self
loadSpotsForLocation
:
newLocation
];
}
#pragma mark - NSTableViewDataSource
-
(
NSInteger
)
numberOfRowsInTableView
:
(
NSTableView
*
)
tableView
{
return
[
self
.
nearbySpots
count
];
}
// The following is what happens when a longtime iOS dev attempts to work with AppKit. I'm sure there's a _much_ better way to do this.
-
(
id
)
tableView
:
(
NSTableView
*
)
tableView
objectValueForTableColumn
:
(
NSTableColumn
*
)
tableColumn
row
:
(
NSInteger
)
row
{
Spot
*
spot
=
[
self
.
nearbySpots
objectAtIndex
:
row
];
if
([[
tableColumn
dataCell
]
isMemberOfClass
:[
NSImageCell
class
]])
{
NSURL
*
imageURL
=
[
NSURL
URLWithString
:
spot
.
imageURLString
];
NSImage
*
image
=
[[
AFImageCache
sharedImageCache
]
cachedImageForURL
:
imageURL
cacheName
:
nil
];
if
(
!
image
)
{
NSURLRequest
*
imageRequest
=
[
NSURLRequest
requestWithURL
:[
NSURL
URLWithString
:
spot
.
imageURLString
]];
AFImageRequestOperation
*
operation
=
[
AFImageRequestOperation
imageRequestOperationWithRequest
:
imageRequest
success
:
^
(
NSImage
*
image
)
{
[
tableView
reloadDataForRowIndexes
:[
NSIndexSet
indexSetWithIndex
:
row
]
columnIndexes
:[
NSIndexSet
indexSetWithIndex
:
0
]];
}];
[
self
.
imageOperationQueue
addOperation
:
operation
];
image
=
[
NSImage
imageNamed
:
@"placeholder-stamp.png"
];
}
return
image
;
}
else
{
return
spot
.
name
;
}
}
@end
examples/AFNetworking Mac Example/Classes/Models/Spot.h
0 → 100644
View file @
f4c26ae4
// Spot.h
//
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
@interface
Spot
:
NSObject
{
@private
NSString
*
_name
;
NSString
*
_imageURLString
;
NSNumber
*
_latitude
;
NSNumber
*
_longitude
;
}
@property
(
strong
)
NSString
*
name
;
@property
(
strong
)
NSString
*
imageURLString
;
@property
(
strong
)
NSNumber
*
latitude
;
@property
(
strong
)
NSNumber
*
longitude
;
@property
(
readonly
)
CLLocation
*
location
;
-
(
id
)
initWithAttributes
:(
NSDictionary
*
)
attributes
;
+
(
void
)
spotsWithURLString
:(
NSString
*
)
urlString
near
:(
CLLocation
*
)
location
parameters
:(
NSDictionary
*
)
parameters
block
:(
void
(
^
)(
NSArray
*
records
))
block
;
@end
examples/AFNetworking Mac Example/Classes/Models/Spot.m
0 → 100644
View file @
f4c26ae4
// Spot.m
//
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "Spot.h"
#import "AFGowallaAPIClient.h"
@implementation
Spot
@synthesize
name
=
_name
;
@synthesize
imageURLString
=
_imageURLString
;
@synthesize
latitude
=
_latitude
;
@synthesize
longitude
=
_longitude
;
@dynamic
location
;
-
(
id
)
initWithAttributes
:(
NSDictionary
*
)
attributes
{
self
=
[
super
init
];
if
(
!
self
)
{
return
nil
;
}
self
.
name
=
[
attributes
valueForKeyPath
:
@"name"
];
self
.
imageURLString
=
[
attributes
valueForKeyPath
:
@"image_url"
];
self
.
latitude
=
[
attributes
valueForKeyPath
:
@"lat"
];
self
.
longitude
=
[
attributes
valueForKeyPath
:
@"lng"
];
return
self
;
}
-
(
CLLocation
*
)
location
{
return
[[
CLLocation
alloc
]
initWithLatitude
:[
self
.
latitude
doubleValue
]
longitude
:[
self
.
longitude
doubleValue
]];
}
+
(
void
)
spotsWithURLString
:
(
NSString
*
)
urlString
near
:
(
CLLocation
*
)
location
parameters
:
(
NSDictionary
*
)
parameters
block
:
(
void
(
^
)(
NSArray
*
records
))
block
{
NSDictionary
*
mutableParameters
=
[
NSMutableDictionary
dictionaryWithDictionary
:
parameters
];
if
(
location
)
{
[
mutableParameters
setValue
:[
NSString
stringWithFormat
:
@"%1.7f"
,
location
.
coordinate
.
latitude
]
forKey
:
@"lat"
];
[
mutableParameters
setValue
:[
NSString
stringWithFormat
:
@"%1.7f"
,
location
.
coordinate
.
longitude
]
forKey
:
@"lng"
];
}
[[
AFGowallaAPIClient
sharedClient
]
getPath
:
urlString
parameters
:
mutableParameters
success
:^
(
id
object
)
{
NSMutableArray
*
mutableRecords
=
[
NSMutableArray
array
];
for
(
NSDictionary
*
attributes
in
[
object
valueForKeyPath
:
@"spots"
])
{
Spot
*
spot
=
[[
Spot
alloc
]
initWithAttributes
:
attributes
];
[
mutableRecords
addObject
:
spot
];
}
if
(
block
)
{
block
([
NSArray
arrayWithArray
:
mutableRecords
]);
}
}
failure
:^
(
NSHTTPURLResponse
*
response
,
NSError
*
error
)
{
if
(
block
)
{
block
([
NSArray
array
]);
}
}];
}
@end
examples/AFNetworking Mac Example/Images/placeholder-stamp.png
0 → 100644
View file @
f4c26ae4
3.88 KB
examples/AFNetworking Mac Example/Info.plist
0 → 100644
View file @
f4c26ae4
<
?xml
v
e
rsion="
1
.
0
"
e
n
c
o
d
ing="UT
F
-
8
"?
>
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
k
e
y
>
CFBundleDevelopmentRegion
<
/k
e
y
>
<
string
>
en
<
/string
>
<
k
e
y
>
CFBundleExecutable
<
/k
e
y
>
<
string
>
$
{
EXECUTABLE_NAME
}<
/string
>
<
k
e
y
>
CFBundleIconFile
<
/k
e
y
>
<
string
><
/string
>
<
k
e
y
>
CFBundleIdentifier
<
/k
e
y
>
<
string
>
com.alamofire.$
{
PRODUCT_NAME:rfc1034identifier
}<
/string
>
<
k
e
y
>
CFBundleInfoDictionaryVersion
<
/k
e
y
>
<
string
>
6.0
<
/string
>
<
k
e
y
>
CFBundleName
<
/k
e
y
>
<
string
>
$
{
PRODUCT_NAME
}<
/string
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
APPL
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
1.0
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
1
<
/string
>
<
k
e
y
>
LSApplicationCategoryType
<
/k
e
y
>
<
string
>
public.app-category.utilities
<
/string
>
<
k
e
y
>
LSMinimumSystemVersion
<
/k
e
y
>
<
string
>
$
{
MACOSX_DEPLOYMENT_TARGET
}<
/string
>
<
k
e
y
>
NSHumanReadableCopyright
<
/k
e
y
>
<
string
>
Copyright
©
2011
Gowalla.
All
rights
reserved.
<
/string
>
<
k
e
y
>
NSMainNibFile
<
/k
e
y
>
<
string
>
MainMenu
<
/string
>
<
k
e
y
>
NSPrincipalClass
<
/k
e
y
>
<
string
>
NSApplication
<
/string
>
<
/
d
i
c
t
>
<
/plist
>
examples/AFNetworking Mac Example/Podfile
0 → 100644
View file @
f4c26ae4
platform
:osx
dependency
'FormatterKit'
dependency
do
|
s
|
s
.
name
=
'AFNetworking'
s
.
version
=
'0.7.0'
s
.
summary
=
'A delightful iOS networking library with NSOperations and block-based callbacks'
s
.
homepage
=
'https://github.com/gowalla/AFNetworking'
s
.
author
=
{
'Gowalla'
=>
'live@gowalla.com'
}
s
.
source
=
{
:git
=>
'https://github.com/gowalla/AFNetworking.git'
,
:tag
=>
'0.7.0'
}
s
.
source_files
=
'AFNetworking'
s
.
clean_paths
=
[
'iOS Example'
,
'Mac Example'
,
'AFNetworking.xcworkspace'
]
s
.
library
=
'z'
s
.
dependency
'JSONKit'
end
examples/AFNetworking Mac Example/Prefix.pch
0 → 100644
View file @
f4c26ae4
//
// Prefix header for all source files of the 'AFNetworking Mac Example' target in the 'AFNetworking Mac Example' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
examples/AFNetworking Mac Example/en.lproj/Credits.rtf
0 → 100644
View file @
f4c26ae4
{\rtf1\ansi\ansicpg1252\cocoartf1138
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid1\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1}}
{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}}
\vieww9600\viewh8400\viewkind0
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720
\f0\b\fs24 \cf0 AFNetworking Creators\
\pard\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\pardirnatural
\ls1\ilvl0
\b0 \cf0 {\listtext \uc0\u8259 }Mattt Thompson\
{\listtext \uc0\u8259 }Scott Raymond}
\ No newline at end of file
examples/AFNetworking Mac Example/en.lproj/MainMenu.xib
0 → 100644
View file @
f4c26ae4
This diff is collapsed.
Click to expand it.
examples/AFNetworking Mac Example/main.m
0 → 100644
View file @
f4c26ae4
//
main
.
m
//
//
Copyright
(
c
)
2011
Gowalla
(
http
://
gowalla
.
com
/)
//
//
Permission
is
hereby
granted
,
free
of
charge
,
to
any
person
obtaining
a
copy
//
of
this
software
and
associated
documentation
files
(
the
"
Software
"
),
to
deal
//
in
the
Software
without
restriction
,
including
without
limitation
the
rights
//
to
use
,
copy
,
modify
,
merge
,
publish
,
distribute
,
sublicense
,
and
/
or
sell
//
copies
of
the
Software
,
and
to
permit
persons
to
whom
the
Software
is
//
furnished
to
do
so
,
subject
to
the
following
conditions
:
//
//
The
above
copyright
notice
and
this
permission
notice
shall
be
included
in
//
all
copies
or
substantial
portions
of
the
Software
.
//
//
THE
SOFTWARE
IS
PROVIDED
"
AS
IS
"
,
WITHOUT
WARRANTY
OF
ANY
KIND
,
EXPRESS
OR
//
IMPLIED
,
INCLUDING
BUT
NOT
LIMITED
TO
THE
WARRANTIES
OF
MERCHANTABILITY
,
//
FITNESS
FOR
A
PARTICULAR
PURPOSE
AND
NONINFRINGEMENT
.
IN
NO
EVENT
SHALL
THE
//
AUTHORS
OR
COPYRIGHT
HOLDERS
BE
LIABLE
FOR
ANY
CLAIM
,
DAMAGES
OR
OTHER
//
LIABILITY
,
WHETHER
IN
AN
ACTION
OF
CONTRACT
,
TORT
OR
OTHERWISE
,
ARISING
FROM
,
//
OUT
OF
OR
IN
CONNECTION
WITH
THE
SOFTWARE
OR
THE
USE
OR
OTHER
DEALINGS
IN
//
THE
SOFTWARE
.
#
import
<
Cocoa
/
Cocoa
.
h
>
int
main
(
int
argc
,
char
*
argv
[])
{
return
NSApplicationMain
(
argc
,
(
const
char
**
)
argv
);
}
examples/AFNetworking iOS Example/Podfile
View file @
f4c26ae4
...
...
@@ -10,19 +10,8 @@ dependency do |s|
s
.
author
=
{
'Gowalla'
=>
'live@gowalla.com'
}
s
.
source
=
{
:git
=>
'https://github.com/gowalla/AFNetworking.git'
,
:tag
=>
'0.7.0'
}
#if config.ios?
s
.
source_files
=
'AFNetworking'
# everything
#else
#s.source_files = %w{
#AFNetworking/AFHTTPRequestOperation.h
#AFNetworking/AFJSONRequestOperation.h
#AFNetworking/NSData+AFNetworking.h
#AFNetworking/NSMutableURLRequest+AFNetworking.h
#AFNetworking/NSString+AFNetworking.h
#}
#end
s
.
clean_paths
=
[
'iOS Example'
,
'Mac Example'
,
'AFNetworking.xcworkspace'
]
s
.
source_files
=
'AFNetworking'
s
.
clean_paths
=
[
'iOS Example'
,
'Mac Example'
,
'AFNetworking.xcworkspace'
]
s
.
library
=
'z'
s
.
dependency
'JSONKit'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment