Commit b31c51ea authored by Marin Usalj's avatar Marin Usalj

Merge branch 'master' into local_repos

Conflicts:
	spec/unit/project_spec.rb
parents d1cf0b99 f3d66709
...@@ -6,24 +6,114 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -6,24 +6,114 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
###### Enhancements ###### Enhancements
* The Pods project now is sorted by name. * Targets passed to the `link_with` method of the Podfile DSL no longer need
to be explicitly passed as an array. `link_with ['target1', 'target2']` can
now be written as `link_with 'target1', 'target2'`.
[Adam Sharp](https://github.com/sharplet)
[Core#30](https://github.com/CocoaPods/Core/pull/30)
###### Bug Fixes
* The architecture is now set in the build settings of the user build
configurations.
[Fabio Pelosin](https://github.com/irrationalfab)
[#1450](https://github.com/CocoaPods/CocoaPods/issues/1462)
[#1462](https://github.com/CocoaPods/CocoaPods/issues/1462)
* Fixed a crash related to CocoaPods being unable to resolve an unique build
setting of an user target with custom build configurations.
[Fabio Pelosin](https://github.com/irrationalfab)
[#1462](https://github.com/CocoaPods/CocoaPods/issues/1462)
[#1463](https://github.com/CocoaPods/CocoaPods/issues/1463)
[#1457](https://github.com/CocoaPods/CocoaPods/issues/1457)
* Fixed a defect which prevented subspecs from being dependant on a pod with a
name closely matching the name of one of the subspec's parents.
[Noah McCann](https://github.com/nmccann)
[#29](https://github.com/CocoaPods/Core/pull/29)
## 0.26.2
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.26.1...0.26.2)
[cocoapods-core](https://github.com/CocoaPods/Core/compare/0.26.1...0.26.2)
[Xcodeproj](https://github.com/CocoaPods/Xcodeproj/compare/0.11.1...0.13.0)
###### Bug Fixes
* Fixed a crash which was causing a failure in `pod lib create` if the name of
the Pod included spaces. As spaces are not supported now this is gracefully
handled with an informative message.
[Kyle Fuller](https://github.com/kylef)
[#1456](https://github.com/CocoaPods/CocoaPods/issues/1456)
* If an user target doesn't specify an architecture the value specified for the
project is used in CocoaPods targets.
[Fabio Pelosin](https://github.com/irrationalfab)
[#1450](https://github.com/CocoaPods/CocoaPods/issues/1450)
* The Pods project now properly configures ARC on all build configurations.
[Fabio Pelosin](https://github.com/irrationalfab)
[#1454](https://github.com/CocoaPods/CocoaPods/issues/1454)
## 0.26.1
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.25.0...0.26.1)
[cocoapods-core](https://github.com/CocoaPods/Core/compare/0.25.0...0.26.1)
[Xcodeproj](https://github.com/CocoaPods/Xcodeproj/compare/0.11.1...0.12.0)
###### Enhancements
* CocoaPods now creates and hides the schemes of its targets after every
installation. The schemes are not shared because the flag which keeps track
whether they should be visible is a user only flag. The schemes are still
present and to debug a single Pod it is possible to make its scheme visible
in the Schemes manager of Xcode. This is rarely needed though because the
user targets trigger the compilation of the Pod targets.
[Fabio Pelosin](https://github.com/irrationalfab)
[#1185](https://github.com/CocoaPods/CocoaPods/pull/1185)
* Installations which don't integrate a user target (lint subcommands and
`--no-integrate` option) now set the architecture of OS X Pod targets to
`$(ARCHS_STANDARD_64_BIT)` (Xcode 4 default value for new targets). This
fixes lint issues with Xcode 4.
[Fabio Pelosin](https://github.com/irrationalfab)
[#1185](https://github.com/CocoaPods/CocoaPods/pull/1185)
* Further improvements to the organization of the Pods project
- The project is now is sorted by name with groups at the bottom.
- Source files are now stored in the root group of the spec, subspecs are not
stored in a `Subspec` group anymore and the products of the Pods all are
stored in the products group of the project.
- The frameworks are referenced relative to the Developer directory and
namespaced per platform.
[Fabio Pelosin](https://github.com/irrationalfab)
[#1389](https://github.com/CocoaPods/CocoaPods/pull/1389) [#1389](https://github.com/CocoaPods/CocoaPods/pull/1389)
[#1420](https://github.com/CocoaPods/CocoaPods/pull/1420)
* Added the `documentation_url` DSL attribute to the specifications. * Added the `documentation_url` DSL attribute to the specifications.
[Fabio Pelosin](https://github.com/irrationalfab)
[#1273](https://github.com/CocoaPods/CocoaPods/pull/1273) [#1273](https://github.com/CocoaPods/CocoaPods/pull/1273)
###### Bug Fixes ###### Bug Fixes
* The search paths of vendored frameworks and libraries now are always * The search paths of vendored frameworks and libraries now are always
specified relatively. specified relatively.
[Fabio Pelosin](https://github.com/irrationalfab)
[#1405](https://github.com/CocoaPods/CocoaPods/pull/1405) [#1405](https://github.com/CocoaPods/CocoaPods/pull/1405)
* Fix an issue where CocoaPods would fail to work when used with an older * Fix an issue where CocoaPods would fail to work when used with an older
version of activesupport. This fix raises the dependency version to version of the Active Support gem. This fix raises the dependency version to
the earliest compatible version of activesupport. the earliest compatible version of Active Support.
[Kyle Fuller](https://github.com/kylef) [Kyle Fuller](https://github.com/kylef)
[#1407](https://github.com/CocoaPods/CocoaPods/issues/1407) [#1407](https://github.com/CocoaPods/CocoaPods/issues/1407)
* CocoaPods will not attempt to load anymore all the version of a specification
preventing crashes if those are incompatible.
[Fabio Pelosin](https://github.com/irrationalfab)
[#1272](https://github.com/CocoaPods/CocoaPods/pull/1272)
## 0.25.0 ## 0.25.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.24.0...0.25.0) [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.24.0...0.25.0)
...@@ -37,13 +127,15 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -37,13 +127,15 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
The generated Pods Xcode project is now compatible with `arm64` projects and The generated Pods Xcode project is now compatible with `arm64` projects and
is updated to use Xcode 5’s default settings removing all warnings. is updated to use Xcode 5’s default settings removing all warnings.
**NOTE to Xcode 4 users:** **NOTE to users migrating projects from Xcode 4, or are still using Xcode 4:**
1. This means that the Pods Xcode project now sets the `ONLY_ACTIVE_ARCH` 1. The Pods Xcode project now sets the `ONLY_ACTIVE_ARCH` build setting to
build setting to `YES` in the `Debug` configuration. You’ll have to set the `YES` in the `Debug` configuration. You _will_ have to set the same on your
same on your project/target, otherwise the build _will_ fail. project/target, otherwise the build _will_ fail.
2. When building a **iOS** project from the command-line with the `xcodebuild` 2. Ensure your project/target has an `ARCHS` value set, otherwise the build
tool you’ll need to completely disable this setting by appending to your _will_ fail.
build command: `ONLY_ACTIVE_ARCH=NO`. 3. When building a **iOS** project from the command-line, with the `xcodebuild`
tool that comes with Xcode 4, you’ll need to completely disable this setting
by appending to your build command: `ONLY_ACTIVE_ARCH=NO`.
[#1352](https://github.com/CocoaPods/CocoaPods/pull/1352) [#1352](https://github.com/CocoaPods/CocoaPods/pull/1352)
......
...@@ -18,7 +18,7 @@ group :development do ...@@ -18,7 +18,7 @@ group :development do
gem "mocha-on-bacon" gem "mocha-on-bacon"
gem 'prettybacon', :git => 'https://github.com/irrationalfab/PrettyBacon.git', :branch => 'master' gem 'prettybacon', :git => 'https://github.com/irrationalfab/PrettyBacon.git', :branch => 'master'
gem "rake" gem "rake"
gem 'coveralls', :require => false, :git => 'https://github.com/lemurheavy/coveralls-ruby.git' gem 'coveralls', :require => false
# Explicitly add this, otherwise it might sometimes be missing: # Explicitly add this, otherwise it might sometimes be missing:
# https://github.com/lemurheavy/coveralls-ruby/blob/master/coveralls-ruby.gemspec#L23. # https://github.com/lemurheavy/coveralls-ruby/blob/master/coveralls-ruby.gemspec#L23.
gem 'simplecov' gem 'simplecov'
......
...@@ -7,21 +7,21 @@ GIT ...@@ -7,21 +7,21 @@ GIT
GIT GIT
remote: https://github.com/CocoaPods/Core.git remote: https://github.com/CocoaPods/Core.git
revision: 24b9357066e2d174d5e066de78b82e57b94a593a revision: 95a4edaac972f6183e1c19e4b519f5d79e14898d
branch: master branch: master
specs: specs:
cocoapods-core (0.25.0) cocoapods-core (0.26.2)
activesupport (~> 3.0) activesupport (~> 3.0)
json (~> 1.8) json (~> 1.8)
nap (~> 0.5) nap (~> 0.5)
GIT GIT
remote: https://github.com/CocoaPods/Xcodeproj.git remote: https://github.com/CocoaPods/Xcodeproj.git
revision: 12c03cded738b149371e0aecc344d4436061c38c revision: 137c22774ca770e112fb8eeb2f10473db7587d16
branch: master branch: master
specs: specs:
xcodeproj (0.11.1) xcodeproj (0.13.1)
activesupport (~> 3.2) activesupport (~> 3.0)
colored (~> 1.2) colored (~> 1.2)
GIT GIT
...@@ -47,30 +47,19 @@ GIT ...@@ -47,30 +47,19 @@ GIT
prettybacon (0.0.1) prettybacon (0.0.1)
bacon (~> 1.2) bacon (~> 1.2)
GIT
remote: https://github.com/lemurheavy/coveralls-ruby.git
revision: b1a5dcc23a4a9cb02a6a1560c63861d102530cd9
specs:
coveralls (0.7.0)
multi_json (~> 1.3)
rest-client
simplecov (>= 0.7)
term-ansicolor
thor
PATH PATH
remote: . remote: .
specs: specs:
cocoapods (0.25.0) cocoapods (0.26.2)
activesupport (~> 3.2) activesupport (~> 3.2)
claide (~> 0.3.2) claide (~> 0.3.2)
cocoapods-core (= 0.25.0) cocoapods-core (= 0.26.2)
cocoapods-downloader (~> 0.2.0) cocoapods-downloader (~> 0.2.0)
colored (~> 1.2) colored (~> 1.2)
escape (~> 0.0.4) escape (~> 0.0.4)
json (~> 1.8) json (~> 1.8)
open4 (~> 1.3) open4 (~> 1.3)
xcodeproj (~> 0.11.0) xcodeproj (~> 0.13.1)
GEM GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
...@@ -78,10 +67,16 @@ GEM ...@@ -78,10 +67,16 @@ GEM
activesupport (3.2.14) activesupport (3.2.14)
i18n (~> 0.6, >= 0.6.4) i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0) multi_json (~> 1.0)
awesome_print (1.1.0) awesome_print (1.2.0)
bacon (1.2.0) bacon (1.2.0)
coderay (1.0.9) coderay (1.0.9)
colored (1.2) colored (1.2)
coveralls (0.7.0)
multi_json (~> 1.3)
rest-client
simplecov (>= 0.7)
term-ansicolor
thor
diffy (3.0.1) diffy (3.0.1)
escape (0.0.4) escape (0.0.4)
ffi (1.9.0) ffi (1.9.0)
...@@ -99,7 +94,7 @@ GEM ...@@ -99,7 +94,7 @@ GEM
metaclass (~> 0.0.1) metaclass (~> 0.0.1)
mocha-on-bacon (0.2.2) mocha-on-bacon (0.2.2)
mocha (>= 0.13.0) mocha (>= 0.13.0)
multi_json (1.8.0) multi_json (1.8.1)
nap (0.5.1) nap (0.5.1)
open4 (1.3.0) open4 (1.3.0)
posix-spawn (0.3.6) posix-spawn (0.3.6)
...@@ -128,7 +123,7 @@ GEM ...@@ -128,7 +123,7 @@ GEM
term-ansicolor (1.2.2) term-ansicolor (1.2.2)
tins (~> 0.8) tins (~> 0.8)
thor (0.18.1) thor (0.18.1)
tins (0.10.0) tins (0.11.0)
yajl-ruby (1.1.0) yajl-ruby (1.1.0)
yard (0.8.7.2) yard (0.8.7.2)
...@@ -142,7 +137,7 @@ DEPENDENCIES ...@@ -142,7 +137,7 @@ DEPENDENCIES
cocoapods! cocoapods!
cocoapods-core! cocoapods-core!
cocoapods-downloader! cocoapods-downloader!
coveralls! coveralls
diffy diffy
github-markup github-markup
kicker! kicker!
......
# CocoaPods – an Objective-C library manager # CocoaPods
### the Objective-C dependency manager
[![Build Status](https://travis-ci.org/CocoaPods/CocoaPods.png?branch=master)](https://travis-ci.org/CocoaPods/CocoaPods) [![Build Status](https://travis-ci.org/CocoaPods/CocoaPods.png?branch=master)](https://travis-ci.org/CocoaPods/CocoaPods)
[![Code Climate](https://codeclimate.com/github/CocoaPods/CocoaPods.png)](https://codeclimate.com/github/CocoaPods/CocoaPods)
[![Dependency Status](https://gemnasium.com/CocoaPods/CocoaPods.png)](https://gemnasium.com/CocoaPods/CocoaPods)
[![Gem Version](https://badge.fury.io/rb/cocoapods.png)](http://badge.fury.io/rb/cocoapods) [![Gem Version](https://badge.fury.io/rb/cocoapods.png)](http://badge.fury.io/rb/cocoapods)
[![Code Climate](https://codeclimate.com/github/CocoaPods/CocoaPods.png)](https://codeclimate.com/github/CocoaPods/CocoaPods)
CocoaPods manages library dependencies for your Xcode project. CocoaPods manages dependencies for your Xcode project.
You specify the dependencies for your project in one easy text file. CocoaPods You specify the dependencies for your project in one easy text file. CocoaPods
resolves dependencies between libraries, fetches source code for the resolves dependencies between libraries, fetches source code for the
...@@ -22,17 +23,28 @@ See the [NSScreencast](https://twitter.com/NSScreencast) episode about [using ...@@ -22,17 +23,28 @@ See the [NSScreencast](https://twitter.com/NSScreencast) episode about [using
CocoaPods](http://nsscreencast.com/episodes/5-cocoapods) for a quick overview. CocoaPods](http://nsscreencast.com/episodes/5-cocoapods) for a quick overview.
## Sponsors
Lovingly sponsored by [Fingertips](http://www.fngtps.com),
[Hipbyte](http://www.hipbyte.com), [Artsy](http://artsy.net) and
[Sauspiel](https://www.sauspiel.de).
## Collaborate
All CocoaPods development happens on GitHub, contributions make good karma and
we welcome with joy new contributors.
## Links ## Links
| Link | Description | | Link | Description |
| :----- | :------ | | :----- | :------ |
[CocoaPods.org](http://cocoapods.org/) | Homepage and search for Pods. [CocoaPods.org](http://cocoapods.org/) | Homepage and search for Pods.
[@CocoaPods](http://twitter.com/CocoaPods) | Follow CocoaPods on Twitter to get up to date information about what's going on in the CocoaPods world. [@CocoaPods](http://twitter.com/CocoaPods) | Follow CocoaPods on Twitter to stay up to date.
[Mailing List](http://groups.google.com/group/cocoapods) | Announcements and support. Feel free to ask any kind of question. [Blog](http://blog.cocoapods.org) | The CocoaPods blog.
[Mailing List](http://groups.google.com/group/cocoapods) | Feel free to ask any kind of question.
[Documentation](http://docs.cocoapods.org) | Everything you want to know about CocoaPods. [Documentation](http://docs.cocoapods.org) | Everything you want to know about CocoaPods.
[Changelog](https://github.com/CocoaPods/CocoaPods/blob/master/CHANGELOG.md) | See the changes introduced by each CocoaPods version. [Changelog](https://github.com/CocoaPods/CocoaPods/blob/master/CHANGELOG.md) | See the changes introduced by each CocoaPods version.
[RSS feed](http://feeds.cocoapods.org/new-pods.rss) | Don't miss any new Pod. [New Pods RSS](http://feeds.cocoapods.org/new-pods.rss) | Don't miss any new Pod.
## Projects ## Projects
...@@ -42,53 +54,8 @@ CocoaPods is composed by the following projects: ...@@ -42,53 +54,8 @@ CocoaPods is composed by the following projects:
| :----- | :------ | :--- | :--- | | :----- | :------ | :--- | :--- |
| [![Build Status](https://secure.travis-ci.org/CocoaPods/CocoaPods.png?branch=master)](http://travis-ci.org/CocoaPods/CocoaPods) | [CocoaPods](https://github.com/CocoaPods/CocoaPods) | The CocoaPods command line tool. | [docs](http://docs.cocoapods.org/cocoapods) | [![Build Status](https://secure.travis-ci.org/CocoaPods/CocoaPods.png?branch=master)](http://travis-ci.org/CocoaPods/CocoaPods) | [CocoaPods](https://github.com/CocoaPods/CocoaPods) | The CocoaPods command line tool. | [docs](http://docs.cocoapods.org/cocoapods)
| [![Build Status](https://secure.travis-ci.org/CocoaPods/Core.png?branch=master)](http://travis-ci.org/CocoaPods/Core) | [CocoaPods Core](https://github.com/CocoaPods/Core) | Support for working with specifications and podfiles. | [docs](http://docs.cocoapods.org/cocoapods_core) | [![Build Status](https://secure.travis-ci.org/CocoaPods/Core.png?branch=master)](http://travis-ci.org/CocoaPods/Core) | [CocoaPods Core](https://github.com/CocoaPods/Core) | Support for working with specifications and podfiles. | [docs](http://docs.cocoapods.org/cocoapods_core)
| [![Build Status](https://secure.travis-ci.org/CocoaPods/cocoapods-downloader.png?branch=master)](http://travis-ci.org/CocoaPods/cocoapods-downloader) |[CocoaPods Downloader](https://github.com/CocoaPods/cocoapods-downloader) | A small library that provides downloaders for various source types. | [docs](http://docs.cocoapods.org/cocoapods_downloader/index.html) | [![Build Status](https://secure.travis-ci.org/CocoaPods/cocoapods-downloader.png?branch=master)](http://travis-ci.org/CocoaPods/cocoapods-downloader) |[CocoaPods Downloader](https://github.com/CocoaPods/cocoapods-downloader) | Downloaders for various source types. | [docs](http://docs.cocoapods.org/cocoapods_downloader/index.html)
| [![Build Status](https://travis-ci.org/CocoaPods/Xcodeproj.png?branch=master)](https://travis-ci.org/CocoaPods/Xcodeproj) | [Xcodeproj](https://github.com/CocoaPods/Xcodeproj) | Create and modify Xcode projects from Ruby. | [docs](http://docs.cocoapods.org/xcodeproj/index.html) | [![Build Status](https://travis-ci.org/CocoaPods/Xcodeproj.png?branch=master)](https://travis-ci.org/CocoaPods/Xcodeproj) | [Xcodeproj](https://github.com/CocoaPods/Xcodeproj) | Create and modify Xcode projects from Ruby. | [docs](http://docs.cocoapods.org/xcodeproj/index.html)
| [![Build Status](https://travis-ci.org/CocoaPods/CLAide.png?branch=master)](https://travis-ci.org/CocoaPods/CLAide) | [CLAide](https://github.com/CocoaPods/CLAide) | A small command-line interface framework. | [docs](http://docs.cocoapods.org/claide/index.html) | [![Build Status](https://travis-ci.org/CocoaPods/CLAide.png?branch=master)](https://travis-ci.org/CocoaPods/CLAide) | [CLAide](https://github.com/CocoaPods/CLAide) | A small command-line interface framework. | [docs](http://docs.cocoapods.org/claide/index.html)
| [![Build Status](https://secure.travis-ci.org/CocoaPods/Specs.png?branch=master)](http://travis-ci.org/CocoaPods/Specs) | [Master Repo ](https://github.com/CocoaPods/Specs) | Master repository of specifications. | [guide](http://docs.cocoapods.org/guides/contributing_to_the_master_repo.html) | [![Build Status](https://secure.travis-ci.org/CocoaPods/Specs.png?branch=master)](http://travis-ci.org/CocoaPods/Specs) | [Master Repo ](https://github.com/CocoaPods/Specs) | Master repository of specifications. | [guide](http://docs.cocoapods.org/guides/contributing_to_the_master_repo.html)
## Collaborate
All CocoaPods development happens on GitHub, contributions make good karma and
we welcome with joy new contributors.
# Sponsors
- [@fngtps](http://twitter.com/fngtps) is donating time to work on the design
of the forthcoming cocoapods.org website and donated the money to hire [Max
Steenbergen](http://twitter.com/maxsteenbergen) to design [an
icon](http://drbl.in/cpmL) for it.
- [@sauspiel](http://twitter.com/Sauspiel) uses CocoaPods for their games and
have hired @alloy to add features and specs they needed. These are Nimbus,
QuincyKit, and HockeyKit. For the [Nimbus
spec](https://github.com/CocoaPods/Specs/blob/master/Nimbus/0.9.0/Nimbus.podspec),
the ‘subspecs’ feature was added.
# Endorsements
- “I am crazy excited about this. With the growing number of Objective-C
libraries, this will make things so much better.” –– [Sam
Soffes](http://news.ycombinator.com/item?id=3009154)
- “Are you doing open source iOS components? You really should support
@CocoaPods!” –– [Matthias
Tretter](http://twitter.com/#!/myell0w/status/134955697740840961)
- “So glad someone has finally done this...” –– [Tom
Wilson](http://news.ycombinator.com/item?id=3009349)
- “Anybody who has tasted the coolness of RubyGems (and @gembundler)
understands how cool CocoaPods might be.” –– [StuFF
mc](http://twitter.com/#!/stuffmc/status/115374231591731200)
- “I will be working on getting several of my Objective-C libraries ready for
CocoaPods this week!” –– [Luke
Redpath](http://twitter.com/#!/lukeredpath/status/115510581921988608)
- “Really digg how @alloy is building a potential game changer” –– [Klaas
Speller](https://twitter.com/#!/spllr/status/115914209438601216)
- “@alloy's making an Objective-C package manager. This is fantastic news
kids!” –– [Josh
Abernathy](http://twitter.com/#!/joshaber/status/115273577703555073)
- “A package manager for Cocoa/Objective-C, built with @MacRuby. Awesomeness!”
–– [Johannes
Fahrenkrug](http://twitter.com/#!/jfahrenkrug/status/115303240286998528)
- “This is awesome, I love endorsements!” –– [Appie
Durán](http://twitter.com/#!/AppieDuran)
...@@ -303,22 +303,6 @@ end ...@@ -303,22 +303,6 @@ end
task :examples => "examples:build" task :examples => "examples:build"
namespace :examples do namespace :examples do
def examples
require 'pathname'
result = []
examples = Pathname.new(File.expand_path('../examples', __FILE__))
return [examples + ENV['example']] if ENV['example']
examples.entries.each do |example|
next if %w{ . .. }.include?(example.basename.to_s)
example = examples + example
next unless example.directory?
result << example
end
result
end
#--------------------------------------#
desc "Open all example workspaces in Xcode, which recreates the schemes." desc "Open all example workspaces in Xcode, which recreates the schemes."
task :recreate_workspace_schemes do task :recreate_workspace_schemes do
examples.each do |example| examples.each do |example|
...@@ -335,34 +319,26 @@ namespace :examples do ...@@ -335,34 +319,26 @@ namespace :examples do
desc "Build all examples" desc "Build all examples"
task :build do task :build do
Dir.chdir("examples/AFNetworking Example") do
# TODO: sometimes it uses the installed gem puts "Installing Pods"
# Rake::Task['gem:install'].invoke
examples.entries.each do |example|
puts "Building example: #{example}"
Dir.chdir(example.to_s) do
execute_command "rm -rf Pods DerivedData"
# WARNING: This appeart to use sytem gems instead of the bundle ones.
pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/sandbox-pod' pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/sandbox-pod'
execute_command "rm -rf Pods"
execute_command "#{pod_command} install --verbose --no-repo-update" execute_command "#{pod_command} install --verbose --no-repo-update"
command = "xcodebuild -workspace '#{example.basename}.xcworkspace' -scheme '#{example.basename}'"
if (example + 'Podfile').read.include?('platform :ios') puts "Building example: AFNetworking Mac Example'"
# Specifically build against the simulator SDK so we don't have to deal with code signing. execute_command "xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking Example' clean install"
puts "Building example: AFNetworking iOS Example'"
xcode_version = `xcodebuild -version`.scan(/Xcode (.*)\n/).first.first xcode_version = `xcodebuild -version`.scan(/Xcode (.*)\n/).first.first
major_version = xcode_version.split('.').first.to_i major_version = xcode_version.split('.').first.to_i
destination_flag_supported = major_version > 4 # Specifically build against the simulator SDK so we don't have to deal with code signing.
if destination_flag_supported if major_version > 4
command << " -destination 'platform=iOS Simulator,name=iPhone Retina (4-inch)'" execute_command "xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking iOS Example' clean install ONLY_ACTIVE_ARCH=NO -destination 'platform=iOS Simulator,name=iPhone Retina (4-inch)'"
else else
command << " -sdk " sdk = Dir.glob("#{`xcode-select -print-path`.chomp}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk").last
command << Dir.glob("#{`xcode-select -print-path`.chomp}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk").last execute_command "xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking iOS Example' clean install ONLY_ACTIVE_ARCH=NO -sdk #{sdk}"
end end
command << " ONLY_ACTIVE_ARCH=NO"
end
execute_command(command)
end
end end
end end
......
...@@ -30,7 +30,7 @@ s.files = Dir["lib/**/*.rb"] + %w{ bin/pod bin/sandbox-pod README.md LICENSE CHA ...@@ -30,7 +30,7 @@ s.files = Dir["lib/**/*.rb"] + %w{ bin/pod bin/sandbox-pod README.md LICENSE CHA
s.add_runtime_dependency 'cocoapods-core', "= #{Pod::VERSION}" s.add_runtime_dependency 'cocoapods-core', "= #{Pod::VERSION}"
s.add_runtime_dependency 'claide', '~> 0.3.2' s.add_runtime_dependency 'claide', '~> 0.3.2'
s.add_runtime_dependency 'cocoapods-downloader', '~> 0.2.0' s.add_runtime_dependency 'cocoapods-downloader', '~> 0.2.0'
s.add_runtime_dependency 'xcodeproj', '~> 0.11.0' s.add_runtime_dependency 'xcodeproj', '~> 0.13.1'
s.add_runtime_dependency 'colored', '~> 1.2' s.add_runtime_dependency 'colored', '~> 1.2'
s.add_runtime_dependency 'escape', '~> 0.0.4' s.add_runtime_dependency 'escape', '~> 0.0.4'
...@@ -54,6 +54,9 @@ s.files = Dir["lib/**/*.rb"] + %w{ bin/pod bin/sandbox-pod README.md LICENSE CHA ...@@ -54,6 +54,9 @@ s.files = Dir["lib/**/*.rb"] + %w{ bin/pod bin/sandbox-pod README.md LICENSE CHA
lines = text.split("\n") lines = text.split("\n")
current_version_index = lines.find_index { |line| line =~ (/^#{current_verison_title}/) } current_version_index = lines.find_index { |line| line =~ (/^#{current_verison_title}/) }
unless current_version_index
raise "Update the changelog for the last version"
end
previous_version_lines = lines[(current_version_index+1)...-1] previous_version_lines = lines[(current_version_index+1)...-1]
previous_version_index = current_version_index + previous_version_lines.find_index { |line| line =~ (/^#{title_token}/) && !line.include?('rc') } previous_version_index = current_version_index + previous_version_lines.find_index { |line| line =~ (/^#{title_token}/) && !line.include?('rc') }
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
</dict>
</plist>
<?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:AFNetworking Mac Example.xcodeproj'/><FileRef location='group:Pods/Pods.xcodeproj'/></Workspace> <?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:AFNetworking Mac Example.xcodeproj'/><FileRef location='group:AFNetworking iOS Example.xcodeproj'/><FileRef location='group:Pods/Pods.xcodeproj'/></Workspace>
\ No newline at end of file \ No newline at end of file
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
buildForAnalyzing = "YES"> buildForAnalyzing = "YES">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "F8CEEB69142CEC6E00247B03" BlueprintIdentifier = "F8129BFA1591061B009BFE23"
BuildableName = "AFNetworking Mac Example.app" BuildableName = "AFNetworking Example.app"
BlueprintName = "AFNetworking Mac Example" BlueprintName = "AFNetworking Example"
ReferencedContainer = "container:AFNetworking Mac Example.xcodeproj"> ReferencedContainer = "container:AFNetworking Mac Example.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildActionEntry> </BuildActionEntry>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</BuildAction> </BuildAction>
<TestAction <TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug"> buildConfiguration = "Debug">
<Testables> <Testables>
...@@ -32,16 +32,16 @@ ...@@ -32,16 +32,16 @@
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "F8CEEB69142CEC6E00247B03" BlueprintIdentifier = "F8129BFA1591061B009BFE23"
BuildableName = "AFNetworking Mac Example.app" BuildableName = "AFNetworking Example.app"
BlueprintName = "AFNetworking Mac Example" BlueprintName = "AFNetworking Example"
ReferencedContainer = "container:AFNetworking Mac Example.xcodeproj"> ReferencedContainer = "container:AFNetworking Mac Example.xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug" buildConfiguration = "Debug"
...@@ -51,9 +51,9 @@ ...@@ -51,9 +51,9 @@
<BuildableProductRunnable> <BuildableProductRunnable>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "F8CEEB69142CEC6E00247B03" BlueprintIdentifier = "F8129BFA1591061B009BFE23"
BuildableName = "AFNetworking Mac Example.app" BuildableName = "AFNetworking Example.app"
BlueprintName = "AFNetworking Mac Example" BlueprintName = "AFNetworking Example"
ReferencedContainer = "container:AFNetworking Mac Example.xcodeproj"> ReferencedContainer = "container:AFNetworking Mac Example.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
...@@ -69,9 +69,9 @@ ...@@ -69,9 +69,9 @@
<BuildableProductRunnable> <BuildableProductRunnable>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "F8CEEB69142CEC6E00247B03" BlueprintIdentifier = "F8129BFA1591061B009BFE23"
BuildableName = "AFNetworking Mac Example.app" BuildableName = "AFNetworking Example.app"
BlueprintName = "AFNetworking Mac Example" BlueprintName = "AFNetworking Example"
ReferencedContainer = "container:AFNetworking Mac Example.xcodeproj"> ReferencedContainer = "container:AFNetworking Mac Example.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</BuildAction> </BuildAction>
<TestAction <TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug"> buildConfiguration = "Debug">
<Testables> <Testables>
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
</TestAction> </TestAction>
<LaunchAction <LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug" buildConfiguration = "Debug"
......
// AFNetworkingExampleAppDelegate.h // AppDelegate.h
// //
// Copyright (c) 2011 Gowalla (http://gowalla.com/) // Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
...@@ -20,13 +20,25 @@ ...@@ -20,13 +20,25 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#import <UIKit/UIKit.h> #import <Availability.h>
@interface AppDelegate : NSObject <UIApplicationDelegate> { #if __IPHONE_OS_VERSION_MIN_REQUIRED
#import <UIKit/UIKit.h>
} @interface AppDelegate : NSObject <UIApplicationDelegate>
@property (nonatomic, retain) UIWindow *window; @property (nonatomic, strong) UIWindow *window;
@property (nonatomic, retain) UINavigationController *navigationController; @property (nonatomic, strong) UINavigationController *navigationController;
@end @end
#else
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (strong) IBOutlet NSWindow *window;
@property (strong) IBOutlet NSTableView *tableView;
@property (strong) IBOutlet NSArrayController *postsArrayController;
@end
#endif
// AppDelegate.m
//
// Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
//
// 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"
#if __IPHONE_OS_VERSION_MIN_REQUIRED
#import "GlobalTimelineViewController.h"
#import "AFNetworkActivityIndicatorManager.h"
@implementation AppDelegate
@synthesize window = _window;
@synthesize navigationController = _navigationController;
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil];
[NSURLCache setSharedURLCache:URLCache];
[[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];
UITableViewController *viewController = [[GlobalTimelineViewController alloc] initWithStyle:UITableViewStylePlain];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
self.navigationController.navigationBar.tintColor = [UIColor darkGrayColor];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}
@end
#else
#import "Post.h"
#import "User.h"
@implementation AppDelegate
@synthesize window = _window;
@synthesize tableView = _tableView;
@synthesize postsArrayController = _postsArrayController;
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil];
[NSURLCache setSharedURLCache:URLCache];
[self.window makeKeyAndOrderFront:self];
[Post globalTimelinePostsWithBlock:^(NSArray *posts, NSError *error) {
if (error) {
[[NSAlert alertWithMessageText:NSLocalizedString(@"Error", nil) defaultButton:NSLocalizedString(@"OK", nil) alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@",[error localizedDescription]] runModal];
}
self.postsArrayController.content = posts;
}];
[[NSNotificationCenter defaultCenter] addObserverForName:kUserProfileImageDidLoadNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {
[self.tableView reloadData];
}];
}
- (BOOL)applicationShouldHandleReopen:(NSApplication *)application
hasVisibleWindows:(BOOL)flag
{
[self.window makeKeyAndOrderFront:self];
return YES;
}
@end
#endif
// AppDelegate.m // AFAppDotNetAPIClient.h
// //
// Copyright (c) 2011 Gowalla (http://gowalla.com/) // Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
...@@ -20,14 +20,11 @@ ...@@ -20,14 +20,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "AFHTTPClient.h"
#import "AppDelegate.h" @interface AFAppDotNetAPIClient : AFHTTPClient
@implementation AppDelegate + (AFAppDotNetAPIClient *)sharedClient;
@synthesize window = _window;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
}
@end @end
// AFGowallaAPI.m // AFAppDotNetAPIClient.h
// //
// Copyright (c) 2011 Gowalla (http://gowalla.com/) // Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
...@@ -20,22 +20,19 @@ ...@@ -20,22 +20,19 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#import "AFGowallaAPIClient.h" #import "AFAppDotNetAPIClient.h"
#import "AFJSONRequestOperation.h" #import "AFJSONRequestOperation.h"
// Replace this with your own API Key, available at http://api.gowalla.com/api/keys/ static NSString * const kAFAppDotNetAPIBaseURLString = @"https://alpha-api.app.net/";
NSString * const kAFGowallaClientID = @"e7ccb7d3d2414eb2af4663fc91eb2793";
NSString * const kAFGowallaBaseURLString = @"https://api.gowalla.com/"; @implementation AFAppDotNetAPIClient
@implementation AFGowallaAPIClient + (AFAppDotNetAPIClient *)sharedClient {
static AFAppDotNetAPIClient *_sharedClient = nil;
+ (AFGowallaAPIClient *)sharedClient { static dispatch_once_t onceToken;
static AFGowallaAPIClient *_sharedClient = nil; dispatch_once(&onceToken, ^{
static dispatch_once_t oncePredicate; _sharedClient = [[AFAppDotNetAPIClient alloc] initWithBaseURL:[NSURL URLWithString:kAFAppDotNetAPIBaseURLString]];
dispatch_once(&oncePredicate, ^{
_sharedClient = [[self alloc] initWithBaseURL:[NSURL URLWithString:kAFGowallaBaseURLString]];
}); });
return _sharedClient; return _sharedClient;
...@@ -52,11 +49,12 @@ NSString * const kAFGowallaBaseURLString = @"https://api.gowalla.com/"; ...@@ -52,11 +49,12 @@ NSString * const kAFGowallaBaseURLString = @"https://api.gowalla.com/";
// Accept HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 // Accept HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
[self setDefaultHeader:@"Accept" value:@"application/json"]; [self setDefaultHeader:@"Accept" value:@"application/json"];
// X-Gowalla-API-Key HTTP Header; see http://api.gowalla.com/api/docs // By default, the example ships with SSL pinning enabled for the app.net API pinned against the public key of adn.cer file included with the example. In order to make it easier for developers who are new to AFNetworking, SSL pinning is automatically disabled if the base URL has been changed. This will allow developers to hack around with the example, without getting tripped up by SSL pinning.
[self setDefaultHeader:@"X-Gowalla-API-Key" value:kAFGowallaClientID]; if ([[url scheme] isEqualToString:@"https"] && [[url host] isEqualToString:@"alpha-api.app.net"]) {
self.defaultSSLPinningMode = AFSSLPinningModePublicKey;
// X-Gowalla-API-Version HTTP Header; see http://api.gowalla.com/api/docs } else {
[self setDefaultHeader:@"X-Gowalla-API-Version" value:@"1"]; self.defaultSSLPinningMode = AFSSLPinningModeNone;
}
return self; return self;
} }
......
// SpotTableViewCell.h // GlobalTimelineViewController.h
// //
// Copyright (c) 2011 Gowalla (http://gowalla.com/) // Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@class Spot; @interface GlobalTimelineViewController : UITableViewController
@interface SpotTableViewCell : UITableViewCell
@property (nonatomic, retain) Spot *spot;
@end @end
// NearbySpotsViewController.m // GlobalTimelineViewController.m
// //
// Copyright (c) 2011 Gowalla (http://gowalla.com/) // Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
...@@ -20,168 +20,91 @@ ...@@ -20,168 +20,91 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#import "NearbySpotsViewController.h" #import "GlobalTimelineViewController.h"
#import "Spot.h" #import "Post.h"
#import "SpotTableViewCell.h" #import "PostTableViewCell.h"
#import "TTTLocationFormatter.h" @interface GlobalTimelineViewController ()
#import "AFImageCache.h" - (void)reload:(id)sender;
#import "UIImageView+AFNetworking.h"
@interface NearbySpotsViewController ()
@property (readwrite, nonatomic, retain) NSArray *nearbySpots;
@property (readwrite, nonatomic, retain) CLLocationManager *locationManager;
@property (readwrite, nonatomic, retain) UIActivityIndicatorView *activityIndicatorView;
- (void)loadSpotsForLocation:(CLLocation *)location;
- (void)refresh:(id)sender;
@end @end
@implementation NearbySpotsViewController @implementation GlobalTimelineViewController {
@synthesize nearbySpots = _spots; @private
@synthesize locationManager = _locationManager; NSArray *_posts;
@synthesize activityIndicatorView = _activityIndicatorView;
- (id)init {
self = [super init];
if (!self) {
return nil;
}
self.nearbySpots = [NSArray array];
self.locationManager = [[[CLLocationManager alloc] init] autorelease]; __strong UIActivityIndicatorView *_activityIndicatorView;
self.locationManager.delegate = self;
self.locationManager.distanceFilter = 80.0;
return self;
}
- (void)dealloc {
[_spots release];
[_locationManager release];
[_activityIndicatorView release];
[super dealloc];
} }
- (void)loadSpotsForLocation:(CLLocation *)location { - (void)reload:(id)sender {
[self.activityIndicatorView startAnimating]; [_activityIndicatorView startAnimating];
self.navigationItem.rightBarButtonItem.enabled = NO; self.navigationItem.rightBarButtonItem.enabled = NO;
[Spot spotsWithURLString:@"/spots" near:location parameters:[NSDictionary dictionaryWithObject:@"128" forKey:@"per_page"] block:^(NSArray *records) { [Post globalTimelinePostsWithBlock:^(NSArray *posts, NSError *error) {
self.nearbySpots = [records sortedArrayUsingComparator:^ NSComparisonResult(id obj1, id obj2) { if (error) {
CLLocationDistance d1 = [[(Spot *)obj1 location] distanceFromLocation:location]; [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) message:[error localizedDescription] delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"OK", nil), nil] show];
CLLocationDistance d2 = [[(Spot *)obj2 location] distanceFromLocation:location];
if (d1 < d2) {
return NSOrderedAscending;
} else if (d1 > d2) {
return NSOrderedDescending;
} else { } else {
return NSOrderedSame; _posts = posts;
}
}];
[self.tableView reloadData]; [self.tableView reloadData];
}
[self.activityIndicatorView stopAnimating]; [_activityIndicatorView stopAnimating];
self.navigationItem.rightBarButtonItem.enabled = YES; self.navigationItem.rightBarButtonItem.enabled = YES;
}]; }];
} }
#pragma mark - UIViewController #pragma mark - UIViewController
- (void)loadView {
[super loadView];
_activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
_activityIndicatorView.hidesWhenStopped = YES;
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = NSLocalizedString(@"AFNetworking", nil); self.title = NSLocalizedString(@"AFNetworking", nil);
self.activityIndicatorView = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite] autorelease]; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:_activityIndicatorView];
self.activityIndicatorView.hidesWhenStopped = YES; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(reload:)];
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:self.activityIndicatorView] autorelease];
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh:)] autorelease];
self.navigationItem.rightBarButtonItem.enabled = NO;
[self.navigationController.navigationBar setTintColor:[UIColor darkGrayColor]];
self.tableView.rowHeight = 70.0f; self.tableView.rowHeight = 70.0f;
[self.locationManager startUpdatingLocation]; [self reload:nil];
} }
- (void)viewDidUnload { - (void)viewDidUnload {
[super viewDidUnload]; _activityIndicatorView = nil;
[self.locationManager stopUpdatingLocation];
}
#pragma mark - Actions
- (void)refresh:(id)sender {
self.nearbySpots = [NSArray array];
[self.tableView reloadData];
[[NSURLCache sharedURLCache] removeAllCachedResponses];
[[AFImageCache sharedImageCache] removeAllObjects];
if (self.locationManager.location) {
[self loadSpotsForLocation:self.locationManager.location];
}
}
#pragma mark - CLLocationManagerDelegate
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { [super viewDidUnload];
[self loadSpotsForLocation:newLocation];
} }
#pragma mark - UITableViewDataSource #pragma mark - UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.nearbySpots count]; return [_posts count];
} }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell"; static NSString *CellIdentifier = @"Cell";
SpotTableViewCell *cell = (SpotTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; PostTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) { if (!cell) {
cell = [[[SpotTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; cell = [[PostTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
Spot *spot = [self.nearbySpots objectAtIndex:indexPath.row];
static TTTLocationFormatter *_locationFormatter = nil;
if (!_locationFormatter) {
_locationFormatter = [[TTTLocationFormatter alloc] init];
if (![[[NSLocale currentLocale] objectForKey:NSLocaleUsesMetricSystem] boolValue]) {
[_locationFormatter setUnitSystem:TTTImperialSystem];
}
}
if (self.locationManager.location) {
cell.detailTextLabel.text = [_locationFormatter stringFromDistanceAndBearingFromLocation:self.locationManager.location toLocation:spot.location];
} }
cell.spot = spot; cell.post = [_posts objectAtIndex:indexPath.row];
return cell; return cell;
} }
#pragma mark - UITableViewDelegate #pragma mark - UITableViewDelegate
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if ([self tableView:tableView numberOfRowsInSection:section] > 0) { return [PostTableViewCell heightForCellWithPost:[_posts objectAtIndex:indexPath.row]];
return NSLocalizedString(@"Nearby Spots", nil);
}
return nil;
} }
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
......
// AFGowallaAPI.h // Post.h
// //
// Copyright (c) 2011 Gowalla (http://gowalla.com/) // Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
...@@ -21,11 +21,18 @@ ...@@ -21,11 +21,18 @@
// THE SOFTWARE. // THE SOFTWARE.
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "AFHTTPClient.h"
extern NSString * const kAFGowallaClientID; @class User;
extern NSString * const kAFGowallaBaseURLString;
@interface Post : NSObject
@property (readonly) NSUInteger postID;
@property (readonly) NSString *text;
@property (readonly) User *user;
- (id)initWithAttributes:(NSDictionary *)attributes;
+ (void)globalTimelinePostsWithBlock:(void (^)(NSArray *posts, NSError *error))block;
@interface AFGowallaAPIClient : AFHTTPClient
+ (AFGowallaAPIClient *)sharedClient;
@end @end
// AFGowallaAPI.m // Post.m
// //
// Copyright (c) 2011 Gowalla (http://gowalla.com/) // Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
...@@ -20,48 +20,49 @@ ...@@ -20,48 +20,49 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#import "AFGowallaAPIClient.h" #import "Post.h"
#import "User.h"
#import "AFJSONRequestOperation.h" #import "AFAppDotNetAPIClient.h"
// Replace this with your own API Key, available at http://api.gowalla.com/api/keys/ @implementation Post
NSString * const kAFGowallaClientID = @"e7ccb7d3d2414eb2af4663fc91eb2793"; @synthesize postID = _postID;
@synthesize text = _text;
@synthesize user = _user;
NSString * const kAFGowallaBaseURLString = @"https://api.gowalla.com/"; - (id)initWithAttributes:(NSDictionary *)attributes {
self = [super init];
@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) { if (!self) {
return nil; return nil;
} }
[self registerHTTPOperationClass:[AFJSONRequestOperation class]]; _postID = [[attributes valueForKeyPath:@"id"] integerValue];
_text = [attributes valueForKeyPath:@"text"];
// Accept HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 _user = [[User alloc] initWithAttributes:[attributes valueForKeyPath:@"user"]];
[self setDefaultHeader:@"Accept" value:@"application/json"];
// X-Gowalla-API-Key HTTP Header; see http://api.gowalla.com/api/docs return self;
[self setDefaultHeader:@"X-Gowalla-API-Key" value:kAFGowallaClientID]; }
// X-Gowalla-API-Version HTTP Header; see http://api.gowalla.com/api/docs #pragma mark -
[self setDefaultHeader:@"X-Gowalla-API-Version" value:@"1"];
// X-UDID HTTP Header + (void)globalTimelinePostsWithBlock:(void (^)(NSArray *posts, NSError *error))block {
[self setDefaultHeader:@"X-UDID" value:[[UIDevice currentDevice] uniqueIdentifier]]; [[AFAppDotNetAPIClient sharedClient] getPath:@"stream/0/posts/stream/global" parameters:nil success:^(AFHTTPRequestOperation *operation, id JSON) {
NSArray *postsFromResponse = [JSON valueForKeyPath:@"data"];
NSMutableArray *mutablePosts = [NSMutableArray arrayWithCapacity:[postsFromResponse count]];
for (NSDictionary *attributes in postsFromResponse) {
Post *post = [[Post alloc] initWithAttributes:attributes];
[mutablePosts addObject:post];
}
return self; if (block) {
block([NSArray arrayWithArray:mutablePosts], nil);
}
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
if (block) {
block([NSArray array], error);
}
}];
} }
@end @end
// AFGowallaAPI.h // User.h
// //
// Copyright (c) 2011 Gowalla (http://gowalla.com/) // Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
...@@ -21,11 +21,19 @@ ...@@ -21,11 +21,19 @@
// THE SOFTWARE. // THE SOFTWARE.
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "AFHTTPClient.h"
extern NSString * const kAFGowallaClientID; extern NSString * const kUserProfileImageDidLoadNotification;
extern NSString * const kAFGowallaBaseURLString;
@interface User : NSObject
@property (readonly, nonatomic) NSUInteger userID;
@property (readonly, nonatomic) NSString *username;
@property (readonly, nonatomic, unsafe_unretained) NSURL *avatarImageURL;
- (id)initWithAttributes:(NSDictionary *)attributes;
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
@property (nonatomic, strong) NSImage *profileImage;
#endif
@interface AFGowallaAPIClient : AFHTTPClient
+ (AFGowallaAPIClient *)sharedClient;
@end @end
// Spot.m // User.m
// //
// Copyright (c) 2011 Gowalla (http://gowalla.com/) // Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
...@@ -20,16 +20,25 @@ ...@@ -20,16 +20,25 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#import "Spot.h" #import "User.h"
#import "AFImageRequestOperation.h"
#import "AFGowallaAPIClient.h" NSString * const kUserProfileImageDidLoadNotification = @"com.alamofire.user.profile-image.loaded";
@implementation Spot #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
@synthesize name = _name; @interface User ()
@synthesize imageURLString = _imageURLString; + (NSOperationQueue *)sharedProfileImageRequestOperationQueue;
@synthesize latitude = _latitude; @end
@synthesize longitude = _longitude; #endif
@dynamic location;
@implementation User {
@private
NSString *_avatarImageURLString;
AFImageRequestOperation *_avatarImageRequestOperation;
}
@synthesize userID = _userID;
@synthesize username = _username;
- (id)initWithAttributes:(NSDictionary *)attributes { - (id)initWithAttributes:(NSDictionary *)attributes {
self = [super init]; self = [super init];
...@@ -37,48 +46,52 @@ ...@@ -37,48 +46,52 @@
return nil; return nil;
} }
self.name = [attributes valueForKeyPath:@"name"]; _userID = [[attributes valueForKeyPath:@"id"] integerValue];
self.imageURLString = [attributes valueForKeyPath:@"image_url"]; _username = [attributes valueForKeyPath:@"username"];
self.latitude = [attributes valueForKeyPath:@"lat"]; _avatarImageURLString = [attributes valueForKeyPath:@"avatar_image.url"];
self.longitude = [attributes valueForKeyPath:@"lng"];
return self; return self;
} }
- (void)dealloc { - (NSURL *)avatarImageURL {
[_name release]; return [NSURL URLWithString:_avatarImageURLString];
[_imageURLString release];
[_latitude release];
[_longitude release];
[super dealloc];
} }
- (CLLocation *)location { #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
return [[[CLLocation alloc] initWithLatitude:[self.latitude doubleValue] longitude:[self.longitude doubleValue]] autorelease];
@synthesize profileImage = _profileImage;
+ (NSOperationQueue *)sharedProfileImageRequestOperationQueue {
static NSOperationQueue *_sharedProfileImageRequestOperationQueue = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedProfileImageRequestOperationQueue = [[NSOperationQueue alloc] init];
[_sharedProfileImageRequestOperationQueue setMaxConcurrentOperationCount:8];
});
return _sharedProfileImageRequestOperationQueue;
} }
+ (void)spotsWithURLString:(NSString *)urlString near:(CLLocation *)location parameters:(NSDictionary *)parameters block:(void (^)(NSArray *records))block { - (NSImage *)profileImage {
NSDictionary *mutableParameters = [NSMutableDictionary dictionaryWithDictionary:parameters]; if (!_profileImage && !_avatarImageRequestOperation) {
if (location) { _avatarImageRequestOperation = [AFImageRequestOperation imageRequestOperationWithRequest:[NSURLRequest requestWithURL:self.avatarImageURL] success:^(NSImage *image) {
[mutableParameters setValue:[NSString stringWithFormat:@"%1.7f", location.coordinate.latitude] forKey:@"lat"]; self.profileImage = image;
[mutableParameters setValue:[NSString stringWithFormat:@"%1.7f", location.coordinate.longitude] forKey:@"lng"];
}
[[AFGowallaAPIClient sharedClient] getPath:urlString parameters:mutableParameters success:^(id object) { _avatarImageRequestOperation = nil;
NSMutableArray *mutableRecords = [NSMutableArray array];
for (NSDictionary *attributes in [object valueForKeyPath:@"spots"]) {
Spot *spot = [[[Spot alloc] initWithAttributes:attributes] autorelease];
[mutableRecords addObject:spot];
}
if (block) { [[NSNotificationCenter defaultCenter] postNotificationName:kUserProfileImageDidLoadNotification object:self userInfo:nil];
block([NSArray arrayWithArray:mutableRecords]); }];
}
} failure:^(NSHTTPURLResponse *response, NSError *error) { [_avatarImageRequestOperation setCacheResponseBlock:^NSCachedURLResponse *(NSURLConnection *connection, NSCachedURLResponse *cachedResponse) {
if (block) { return [[NSCachedURLResponse alloc] initWithResponse:cachedResponse.response data:cachedResponse.data userInfo:cachedResponse.userInfo storagePolicy:NSURLCacheStorageAllowed];
block([NSArray array]);
}
}]; }];
[[[self class] sharedProfileImageRequestOperationQueue] addOperation:_avatarImageRequestOperation];
}
return _profileImage;
} }
#endif
@end @end
// AppDelegate.h // TweetTableViewCell.h
// //
// Copyright (c) 2011 Gowalla (http://gowalla.com/) // Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
...@@ -20,13 +20,14 @@ ...@@ -20,13 +20,14 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#import <UIKit/UIKit.h>
#import <Cocoa/Cocoa.h> @class Post;
@interface AppDelegate : NSObject <NSApplicationDelegate> { @interface PostTableViewCell : UITableViewCell
NSWindow *_window;
}
@property (strong) IBOutlet NSWindow *window; @property (nonatomic, strong) Post *post;
+ (CGFloat)heightForCellWithPost:(Post *)post;
@end @end
// SpotTableViewCell.m // TweetTableViewCell.m
// //
// Copyright (c) 2011 Gowalla (http://gowalla.com/) // Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
...@@ -20,14 +20,19 @@ ...@@ -20,14 +20,19 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#import "SpotTableViewCell.h" #import "PostTableViewCell.h"
#import "Spot.h" #import "Post.h"
#import "User.h"
#import "UIImageView+AFNetworking.h" #import "UIImageView+AFNetworking.h"
@implementation SpotTableViewCell @implementation PostTableViewCell {
@synthesize spot = _spot; @private
__strong Post *_post;
}
@synthesize post = _post;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
...@@ -35,63 +40,42 @@ ...@@ -35,63 +40,42 @@
return nil; return nil;
} }
self.textLabel.adjustsFontSizeToFitWidth = YES;
self.textLabel.textColor = [UIColor darkGrayColor]; self.textLabel.textColor = [UIColor darkGrayColor];
self.textLabel.numberOfLines = 2; self.detailTextLabel.font = [UIFont systemFontOfSize:12.0f];
self.textLabel.backgroundColor = self.backgroundColor; self.detailTextLabel.numberOfLines = 0;
self.detailTextLabel.textColor = [UIColor grayColor];
self.detailTextLabel.backgroundColor = self.backgroundColor;
self.imageView.backgroundColor = self.backgroundColor;
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
self.selectionStyle = UITableViewCellSelectionStyleGray; self.selectionStyle = UITableViewCellSelectionStyleGray;
return self; return self;
} }
- (void)dealloc { - (void)setPost:(Post *)post {
[_spot release]; _post = post;
[super dealloc];
}
- (void)setSpot:(Spot *)spot {
[self willChangeValueForKey:@"spot"];
[_spot autorelease];
_spot = [spot retain];
[self didChangeValueForKey:@"spot"];
[self.imageView setImageWithURL:[NSURL URLWithString:self.spot.imageURLString] placeholderImage:[UIImage imageNamed:@"placeholder-stamp.png"]]; self.textLabel.text = _post.user.username;
self.detailTextLabel.text = _post.text;
[self.imageView setImageWithURL:_post.user.avatarImageURL placeholderImage:[UIImage imageNamed:@"profile-image-placeholder"]];
self.textLabel.text = spot.name; [self setNeedsLayout];
} }
#pragma mark - UITableViewCell + (CGFloat)heightForCellWithPost:(Post *)post {
CGSize sizeToFit = [post.text sizeWithFont:[UIFont systemFontOfSize:12.0f] constrainedToSize:CGSizeMake(220.0f, CGFLOAT_MAX) lineBreakMode:UILineBreakModeWordWrap];
- (void)prepareForReuse { return fmaxf(70.0f, sizeToFit.height + 45.0f);
[self.imageView cancelImageRequestOperation];
self.textLabel.text = nil;
self.detailTextLabel.text = nil;
} }
#pragma mark - UIView #pragma mark - UIView
- (void)layoutSubviews { - (void)layoutSubviews {
[super layoutSubviews]; [super layoutSubviews];
CGRect imageViewFrame = self.imageView.frame;
CGRect textLabelFrame = self.textLabel.frame; self.imageView.frame = CGRectMake(10.0f, 10.0f, 50.0f, 50.0f);
CGRect detailTextLabelFrame = self.detailTextLabel.frame; self.textLabel.frame = CGRectMake(70.0f, 10.0f, 240.0f, 20.0f);
imageViewFrame.origin = CGPointMake(10.0f, 10.0f); CGRect detailTextLabelFrame = CGRectOffset(self.textLabel.frame, 0.0f, 25.0f);
imageViewFrame.size = CGSizeMake(50.0f, 50.0f); detailTextLabelFrame.size.height = [[self class] heightForCellWithPost:_post] - 45.0f;
textLabelFrame.origin.x = imageViewFrame.size.width + 25.0f;
detailTextLabelFrame.origin.x = textLabelFrame.origin.x;
textLabelFrame.size.width = 240.0f;
detailTextLabelFrame.size.width = textLabelFrame.size.width;
self.textLabel.frame = textLabelFrame;
self.detailTextLabel.frame = detailTextLabelFrame; self.detailTextLabel.frame = detailTextLabelFrame;
self.imageView.frame = imageViewFrame;
} }
@end @end
...@@ -22,12 +22,10 @@ ...@@ -22,12 +22,10 @@
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1</string> <string>1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string> <string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Copyright © 2011 Gowalla. All rights reserved.</string> <string>Copyright © 2012 Mattt Thompson. All rights reserved.</string>
<key>NSMainNibFile</key> <key>NSMainNibFile</key>
<string>MainMenu</string> <string>MainMenu</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
......
### Implicit target definition :-/
xcodeproj "AFNetworking Mac Example.xcodeproj"
####
workspace 'AFNetworking Examples.xcworkspace'
target "AFNetworking Example" do
platform :osx, '10.8'
xcodeproj "AFNetworking Mac Example.xcodeproj"
pod "AFNetworking", "1.3.3"
end
target "AFNetworking iOS Example" do
platform :ios, '7.0'
xcodeproj "AFNetworking iOS Example.xcodeproj"
pod "AFNetworking", "1.3.3"
end
#import <Availability.h>
#if __IPHONE_OS_VERSION_MIN_REQUIRED
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iPhone SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
#endif
#else
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <CoreServices/CoreServices.h>
#endif
#endif
\ No newline at end of file
This diff is collapsed.
...@@ -10,6 +10,24 @@ ...@@ -10,6 +10,24 @@
<string>${EXECUTABLE_NAME}</string> <string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string></string> <string></string>
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>
<string>Icon@2x.png</string>
</array>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>
<string>Icon@2x.png</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>com.alamofire.${PRODUCT_NAME:rfc1034identifier}</string> <string>com.alamofire.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
...@@ -23,9 +41,13 @@ ...@@ -23,9 +41,13 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0.1.0</string> <string>1.0.0</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>UIPrerenderedIcon</key>
<true/>
<key>UIStatusBarHidden</key>
<false/>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
......
// main.m // main.m
// // Copyright (c) 2012 Mattt Thompson (http://mattt.me/)
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
...@@ -20,10 +19,19 @@ ...@@ -20,10 +19,19 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#if __IPHONE_OS_VERSION_MIN_REQUIRED
#import <UIKit/UIKit.h>
#import <Cocoa/Cocoa.h> int main(int argc, char *argv[]) {
@autoreleasepool {
int retVal = UIApplicationMain(argc, argv, @"UIApplication", @"AppDelegate");
return retVal;
}
}
#else
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[]) int main(int argc, char *argv[]) {
{
return NSApplicationMain(argc, (const char **)argv); return NSApplicationMain(argc, (const char **)argv);
} }
#endif
// 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
// 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
// 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
// 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
platform :osx
pod 'FormatterKit'
pod 'AFNetworking', '~> 0.7.0'
//
// 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
{\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
<?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:AFNetworking iOS Example.xcodeproj'/><FileRef location='group:Pods/Pods.xcodeproj'/></Workspace>
\ No newline at end of file
// AFNetworkingExampleAppDelegate.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"
#import "NearbySpotsViewController.h"
#import "AFNetworkActivityIndicatorManager.h"
@implementation AppDelegate
@synthesize window = _window;
@synthesize navigationController = _navigationController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSURLCache *URLCache = [[[NSURLCache alloc] initWithMemoryCapacity:1024 * 1024 diskCapacity:1024 * 1024 * 5 diskPath:nil] autorelease];
[NSURLCache setSharedURLCache:URLCache];
[[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];
UITableViewController *viewController = [[[NearbySpotsViewController alloc] init] autorelease];
self.navigationController = [[[UINavigationController alloc] initWithRootViewController:viewController] autorelease];
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.window.backgroundColor = [UIColor whiteColor];
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}
- (void)dealloc {
[_window release];
[_navigationController release];
[super dealloc];
}
@end
// 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 <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
@interface NearbySpotsViewController : UITableViewController <CLLocationManagerDelegate> {
NSArray *_nearbySpots;
CLLocationManager *_locationManager;
UIActivityIndicatorView *_activityIndicatorView;
}
@end
// 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 (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *imageURLString;
@property (nonatomic, retain) NSNumber *latitude;
@property (nonatomic, retain) 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
platform :ios
pod 'FormatterKit'
pod 'AFNetworking', '~> 0.7.0'
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iPhone SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
// 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 <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, @"UIApplication", @"AppDelegate");
[pool release];
return retVal;
}
#
# Be sure to run `pod spec lint Example.podspec.podspec' to ensure this is a
# valid spec.
#
# Remove all comments before submitting the spec. Optional attributes are commented.
#
# For details see: https://github.com/CocoaPods/CocoaPods/wiki/The-podspec-format
#
Pod::Spec.new do |s|
s.name = "Example.podspec"
s.version = "0.0.1"
s.summary = "A short description of Example.podspec."
# s.description = <<-DESC
# An optional longer description of Example.podspec
#
# * Markdown format.
# * Don't worry about the indent, we strip it!
# DESC
s.homepage = "http://EXAMPLE/Example.podspec"
# Specify the license type. CocoaPods detects automatically the license file if it is named
# 'LICENCE*.*' or 'LICENSE*.*', however if the name is different, specify it.
s.license = 'MIT (example)'
# s.license = { :type => 'MIT (example)', :file => 'FILE_LICENSE' }
#
# Only if no dedicated file is available include the full text of the license.
#
# s.license = {
# :type => 'MIT (example)',
# :text => <<-LICENSE
# Copyright (C) <year> <copyright holders>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# ...
# LICENSE
# }
# Specify the authors of the library, with email addresses. You can often find
# the email addresses of the authors by using the SCM log. E.g. $ git log
#
s.author = { "Jonathan Beilin" => "jbeilin@gmail.com" }
# s.authors = { "Jonathan Beilin" => "jbeilin@gmail.com", "other author" => "and email address" }
#
# If absolutely no email addresses are available, then you can use this form instead.
#
# s.author = 'Jonathan Beilin', 'other author'
# Specify the location from where the source should be retreived.
#
s.source = { :git => "http://EXAMPLE/Example.podspec.git", :tag => "0.0.1" }
# s.source = { :svn => 'http://EXAMPLE/Example.podspec/tags/1.0.0' }
# s.source = { :hg => 'http://EXAMPLE/Example.podspec', :revision => '1.0.0' }
# If this Pod runs only on iOS or OS X, then specify the platform and
# the deployment target.
#
# s.platform = :ios, '5.0'
# s.platform = :ios
# ――― MULTI-PLATFORM VALUES ――――――――――――――――――――――――――――――――――――――――――――――――― #
# If this Pod runs on both platforms, then specify the deployment
# targets.
#
# s.ios.deployment_target = '5.0'
# s.osx.deployment_target = '10.7'
# A list of file patterns which select the source files that should be
# added to the Pods project. If the pattern is a directory then the
# path will automatically have '*.{h,m,mm,c,cpp}' appended.
#
s.source_files = 'Classes', 'Classes/**/*.{h,m}'
# A list of resources included with the Pod. These are copied into the
# target bundle with a build phase script.
#
# s.resource = "icon.png"
# s.resources = "Resources/*.png"
# A list of paths to preserve after installing the Pod.
# CocoaPods cleans by default any file that is not used.
# Please don't include documentation, example, and test files.
#
# s.preserve_paths = "FilesToSave", "MoreFilesToSave"
# Specify a list of frameworks that the application needs to link
# against for this Pod to work.
#
# s.framework = 'SomeFramework'
# s.frameworks = 'SomeFramework', 'AnotherFramework'
# Specify a list of libraries that the application needs to link
# against for this Pod to work.
#
# s.library = 'iconv'
# s.libraries = 'iconv', 'xml2'
# If this Pod uses ARC, specify it like so.
#
# s.requires_arc = true
# If you need to specify any other build settings, add them to the
# xcconfig hash.
#
# s.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2' }
# Finally, specify any Pods that this Pod depends on.
#
# s.dependency 'JSONKit', '~> 1.4'
end
# NOTE: This is a spec with a lot of ideas I had that _could_ possibly ever be
# added. So this list should, for now, not be taken as all the current
# possibilities.
Pod::Spec.new do
#############################################################################
# Required attributes
#############################################################################
# This pod’s name.
name 'IcePop'
# This pod’s version.
#
# The version string can contain numbers and periods, such as 1.0.0. A pod is
# a ‘prerelease’ pod if the version has a letter in it, such as 1.0.0.pre.
version '1.0.0'
# A short summary of this pod’s description. Displayed in `pod list -d`.
summary 'A library that retrieves the current price of your favorite ice cream.'
# The list of authors and their email addresses.
#
# This attribute is aliased as `author`, which can be used if there’s only
# one author.
authors 'Eloy Durán' => 'eloy.de.enige@gmail.com', 'Appie Durán' => 'appie@dekleineprins.me'
# The download strategy and the URL of the location of this pod’s source.
#
# Options are:
# * :git => 'git://example.org/ice-pop.git'
# * :svn => 'http://example.org/ice-pop/trunk'
# * :tar => 'http://example.org/ice-pop-1.0.0.tar.gz'
# * :zip => 'http://example.org/ice-pop-1.0.0.zip'
source :git => 'https://github.com/alloy/ice-pop.git'
#############################################################################
# Optional attributes
#############################################################################
# A long description of this pod. It should be more detailed than the summary.
#
# It defaults to the summary.
description %{
This library consumes the icecreamexchange.example.org web API to get the
latest prices of all ice cream products known to man. While it’s being used
in production with much success, it’s still under heavy development.
}
# The directories that contain this pod’s source. These will be placed in
# the `HEADER_SEARCH_PATH`.
#
# It defaults to `Source`.
#
# The attribute is aliased to `source_dir`, which can be used if there’s only
# one directory.
source_dirs 'Source/Controllers', 'Source/Models'
# The platforms this pod compiles for.
#
# It defaults to `OSX`.
#
# The attribute is aliased to `platform`, which can be used if there’s only
# one platform.
platforms 'OSX', 'iPhone'
# The SDK needed to compile this pod’s source.
sdk '>= 10.7'
# The URL of this pod’s home page
homepage 'http://ice-pop.example.org'
# Adds a runtime dependency with version requirements to this pod. You can
# add as much dependencies as you’d like by adding extra `dependency` lines.
#
# TODO See version help
dependency 'AsyncSocket', '~> 0.6', '>= 0.6.3'
# Adds a development dependency to this pod. These are *not* needed by the
# end-user, but only for development of this pod itself.
#
# You can create as many groups as you’d like, however, the `development`
# group is assumed, by CocoaPod, to be a set of dependencies for development
# of this pod itself.
group :development do
dependency 'FakeServer', '>= 1'
end
# The tool that should be used to generate documentation from this pod’s
# header files.
#
# It defaults to `appledoc`.
doc_bin 'appledoc'
# The options passed to the `doc_bin` tool when generating documentation from
# this pod’s header files.
#
# It defaults to options for `appledoc` that set the project name and version.
#
# The options specified will be _merged_ with the defaults.
#
# The attribute is aliased to `doc_option`, which can be used if there’s only
# one option.
doc_options '--project-name' => 'IcePop', '--project-version' => '1.0.0'
# Sets whether or not this pod comes with runnable tests.
#
# It defaults to `false`.
has_tests true
# The tool used to run this pod’s tests.
#
# It defaults to `xcodebuild`.
test_bin 'xcodebuild'
# The options passed to the `test_bin` tool when running this pod’s tests.
#
# It defaults to options for `xcodebuil` that set the Xcode project file and
# the name of the target that runs the tests.
#
# The options specified will be _merged_ with the defaults.
#
# The attribute is aliased to `test_option`, which can be used if there’s
# only one option.
test_options '-project' => 'IcePop.xcodeproj', '-target' => 'Test'
end
platform :ios
target :test, :exclusive => true do
link_with 'TargetTest'
pod 'JSONKit'
end
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "51887BB5147465E00005EA71"
BuildableName = "TargetTest.app"
BlueprintName = "TargetTest"
ReferencedContainer = "container:TargetTest.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "51887BB5147465E00005EA71"
BuildableName = "TargetTest.app"
BlueprintName = "TargetTest"
ReferencedContainer = "container:TargetTest.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "51887BB5147465E00005EA71"
BuildableName = "TargetTest.app"
BlueprintName = "TargetTest"
ReferencedContainer = "container:TargetTest.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "51887BB5147465E00005EA71"
BuildableName = "TargetTest.app"
BlueprintName = "TargetTest"
ReferencedContainer = "container:TargetTest.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:TargetTest.xcodeproj'/><FileRef location='group:Pods/Pods.xcodeproj'/></Workspace>
\ No newline at end of file
//
// AppDelegate.h
// TargetTest
//
// Created by Eloy Duran on 16-11-11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
//
// AppDelegate.m
// TargetTest
//
// Created by Eloy Duran on 16-11-11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
#import "AppDelegate.h"
#import "JSONKit.h"
@implementation AppDelegate
@synthesize window = _window;
- (void)dealloc
{
[_window release];
[super dealloc];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
[JSONDecoder class];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
/*
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
*/
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
/*
Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
*/
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
}
- (void)applicationWillTerminate:(UIApplication *)application
{
/*
Called when the application is about to terminate.
Save data if appropriate.
See also applicationDidEnterBackground:.
*/
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFiles</key>
<array/>
<key>CFBundleIdentifier</key>
<string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment