├── .gitignore ├── AJSITunesAPI.podspec ├── AJSITunesAPI.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── AJSITunesAPI.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── AJSITunesAPI.xccheckout ├── AJSITunesAPI ├── AJSITunesAPI-Prefix.pch ├── AJSITunesAPI.h ├── AJSITunesClient.h ├── AJSITunesClient.m ├── AJSITunesResult.h └── AJSITunesResult.m ├── AJSITunesAPITests ├── AJSITunesAPITests-Info.plist ├── AJSITunesAPITests.m └── en.lproj │ └── InfoPlist.strings ├── LICENSE ├── Podfile ├── Podfile.lock └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X files that should never be committed 2 | .DS_Store 3 | *.swp 4 | profile 5 | tmp 6 | 7 | # Xcode temporary files 8 | *~.nib 9 | 10 | # Xcode build files 11 | DerivedData 12 | build 13 | 14 | # Xcode header maps 15 | *.hmap 16 | 17 | # Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups) 18 | *.pbxuser 19 | !default.pbxuser 20 | *.mode1v3 21 | !default.mode1v3 22 | *.mode2v3 23 | !default.mode2v3 24 | *.perspectivev3 25 | !default.perspectivev3 26 | xcuserdata 27 | 28 | # Xcode depricated classes 29 | *.moved-aside 30 | 31 | # AppCode 32 | .idea 33 | 34 | # CocoaPods 35 | Pods -------------------------------------------------------------------------------- /AJSITunesAPI.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "AJSITunesAPI" 4 | s.version = "0.2.0" 5 | s.summary = "API Helper for the iTunes search API, based on AFNetworking and Mantle." 6 | s.description = "API Helper for the iTunes search API, based on AFNetworking and Mantle." 7 | s.homepage = "https://github.com/andysmart/AJS-iTunes-API" 8 | s.license = 'MIT' 9 | s.author = { "Andy Smart" => "andy@andysmart.org" } 10 | s.ios.deployment_target = '7.0' 11 | s.osx.deployment_target = '10.9' 12 | s.source = { :git => "https://github.com/andysmart/AJS-iTunes-API.git", :tag => "0.2.0" } 13 | s.source_files = 'AJSITunesAPI', 'AJSITunesAPI/**/*.{h,m}' 14 | s.requires_arc = true 15 | 16 | s.dependency 'AFNetworking', '~> 2.0' 17 | s.dependency 'Mantle', '~> 1.2' 18 | s.dependency 'ISO8601DateFormatter', '~> 0.6' 19 | end 20 | -------------------------------------------------------------------------------- /AJSITunesAPI.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0948AA6250254B3DA1B2D61C /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F396560AD1834C89A992D171 /* libPods.a */; }; 11 | A194BE2E17DA202C00F19CEF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A194BE2D17DA202C00F19CEF /* Foundation.framework */; }; 12 | A194BE3317DA202C00F19CEF /* AJSITunesAPI.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = A194BE3217DA202C00F19CEF /* AJSITunesAPI.h */; }; 13 | A194BE3C17DA202C00F19CEF /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A194BE3B17DA202C00F19CEF /* XCTest.framework */; }; 14 | A194BE3D17DA202C00F19CEF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A194BE2D17DA202C00F19CEF /* Foundation.framework */; }; 15 | A194BE4217DA202C00F19CEF /* libAJSITunesAPI.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A194BE2A17DA202C00F19CEF /* libAJSITunesAPI.a */; }; 16 | A194BE4817DA202C00F19CEF /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A194BE4617DA202C00F19CEF /* InfoPlist.strings */; }; 17 | A194BE4A17DA202C00F19CEF /* AJSITunesAPITests.m in Sources */ = {isa = PBXBuildFile; fileRef = A194BE4917DA202C00F19CEF /* AJSITunesAPITests.m */; }; 18 | A194BE5517DA221500F19CEF /* AJSITunesClient.m in Sources */ = {isa = PBXBuildFile; fileRef = A194BE5417DA221500F19CEF /* AJSITunesClient.m */; }; 19 | A194BE6617DA262700F19CEF /* AJSITunesResult.m in Sources */ = {isa = PBXBuildFile; fileRef = A194BE6517DA262700F19CEF /* AJSITunesResult.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | A194BE4017DA202C00F19CEF /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = A194BE2217DA202C00F19CEF /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = A194BE2917DA202C00F19CEF; 28 | remoteInfo = AJSITunesAPI; 29 | }; 30 | /* End PBXContainerItemProxy section */ 31 | 32 | /* Begin PBXCopyFilesBuildPhase section */ 33 | A194BE2817DA202C00F19CEF /* CopyFiles */ = { 34 | isa = PBXCopyFilesBuildPhase; 35 | buildActionMask = 2147483647; 36 | dstPath = "include/$(PRODUCT_NAME)"; 37 | dstSubfolderSpec = 16; 38 | files = ( 39 | A194BE3317DA202C00F19CEF /* AJSITunesAPI.h in CopyFiles */, 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | /* End PBXCopyFilesBuildPhase section */ 44 | 45 | /* Begin PBXFileReference section */ 46 | 05B21F86938C4806990CD064 /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = SOURCE_ROOT; }; 47 | A194BE2A17DA202C00F19CEF /* libAJSITunesAPI.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAJSITunesAPI.a; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | A194BE2D17DA202C00F19CEF /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 49 | A194BE3117DA202C00F19CEF /* AJSITunesAPI-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AJSITunesAPI-Prefix.pch"; sourceTree = ""; }; 50 | A194BE3217DA202C00F19CEF /* AJSITunesAPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AJSITunesAPI.h; sourceTree = ""; }; 51 | A194BE3A17DA202C00F19CEF /* AJSITunesAPITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AJSITunesAPITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | A194BE3B17DA202C00F19CEF /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 53 | A194BE4517DA202C00F19CEF /* AJSITunesAPITests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AJSITunesAPITests-Info.plist"; sourceTree = ""; }; 54 | A194BE4717DA202C00F19CEF /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 55 | A194BE4917DA202C00F19CEF /* AJSITunesAPITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AJSITunesAPITests.m; sourceTree = ""; }; 56 | A194BE5317DA221500F19CEF /* AJSITunesClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJSITunesClient.h; sourceTree = ""; }; 57 | A194BE5417DA221500F19CEF /* AJSITunesClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AJSITunesClient.m; sourceTree = ""; }; 58 | A194BE6417DA262700F19CEF /* AJSITunesResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJSITunesResult.h; sourceTree = ""; }; 59 | A194BE6517DA262700F19CEF /* AJSITunesResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AJSITunesResult.m; sourceTree = ""; }; 60 | F396560AD1834C89A992D171 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | A194BE2717DA202C00F19CEF /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | A194BE2E17DA202C00F19CEF /* Foundation.framework in Frameworks */, 69 | 0948AA6250254B3DA1B2D61C /* libPods.a in Frameworks */, 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | A194BE3717DA202C00F19CEF /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | A194BE3C17DA202C00F19CEF /* XCTest.framework in Frameworks */, 78 | A194BE3D17DA202C00F19CEF /* Foundation.framework in Frameworks */, 79 | A194BE4217DA202C00F19CEF /* libAJSITunesAPI.a in Frameworks */, 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | A194BE2117DA202C00F19CEF = { 87 | isa = PBXGroup; 88 | children = ( 89 | A194BE2F17DA202C00F19CEF /* Classes */, 90 | A194BE4317DA202C00F19CEF /* Tests */, 91 | A194BE2C17DA202C00F19CEF /* Frameworks */, 92 | A194BE2B17DA202C00F19CEF /* Products */, 93 | 05B21F86938C4806990CD064 /* Pods.xcconfig */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | A194BE2B17DA202C00F19CEF /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | A194BE2A17DA202C00F19CEF /* libAJSITunesAPI.a */, 101 | A194BE3A17DA202C00F19CEF /* AJSITunesAPITests.xctest */, 102 | ); 103 | name = Products; 104 | sourceTree = ""; 105 | }; 106 | A194BE2C17DA202C00F19CEF /* Frameworks */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | A194BE2D17DA202C00F19CEF /* Foundation.framework */, 110 | A194BE3B17DA202C00F19CEF /* XCTest.framework */, 111 | F396560AD1834C89A992D171 /* libPods.a */, 112 | ); 113 | name = Frameworks; 114 | sourceTree = ""; 115 | }; 116 | A194BE2F17DA202C00F19CEF /* Classes */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | A194BE3017DA202C00F19CEF /* Supporting Files */, 120 | A194BE3217DA202C00F19CEF /* AJSITunesAPI.h */, 121 | A194BE5317DA221500F19CEF /* AJSITunesClient.h */, 122 | A194BE5417DA221500F19CEF /* AJSITunesClient.m */, 123 | A194BE6417DA262700F19CEF /* AJSITunesResult.h */, 124 | A194BE6517DA262700F19CEF /* AJSITunesResult.m */, 125 | ); 126 | name = Classes; 127 | path = AJSITunesAPI; 128 | sourceTree = ""; 129 | }; 130 | A194BE3017DA202C00F19CEF /* Supporting Files */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | A194BE3117DA202C00F19CEF /* AJSITunesAPI-Prefix.pch */, 134 | ); 135 | name = "Supporting Files"; 136 | sourceTree = ""; 137 | }; 138 | A194BE4317DA202C00F19CEF /* Tests */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | A194BE4917DA202C00F19CEF /* AJSITunesAPITests.m */, 142 | A194BE4417DA202C00F19CEF /* Supporting Files */, 143 | ); 144 | name = Tests; 145 | path = AJSITunesAPITests; 146 | sourceTree = ""; 147 | }; 148 | A194BE4417DA202C00F19CEF /* Supporting Files */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | A194BE4517DA202C00F19CEF /* AJSITunesAPITests-Info.plist */, 152 | A194BE4617DA202C00F19CEF /* InfoPlist.strings */, 153 | ); 154 | name = "Supporting Files"; 155 | sourceTree = ""; 156 | }; 157 | /* End PBXGroup section */ 158 | 159 | /* Begin PBXNativeTarget section */ 160 | A194BE2917DA202C00F19CEF /* AJSITunesAPI */ = { 161 | isa = PBXNativeTarget; 162 | buildConfigurationList = A194BE4D17DA202C00F19CEF /* Build configuration list for PBXNativeTarget "AJSITunesAPI" */; 163 | buildPhases = ( 164 | 0DBBED20365E4924A71DE04F /* Check Pods Manifest.lock */, 165 | A194BE2617DA202C00F19CEF /* Sources */, 166 | A194BE2717DA202C00F19CEF /* Frameworks */, 167 | A194BE2817DA202C00F19CEF /* CopyFiles */, 168 | 34347E25FDC442FD90521996 /* Copy Pods Resources */, 169 | ); 170 | buildRules = ( 171 | ); 172 | dependencies = ( 173 | ); 174 | name = AJSITunesAPI; 175 | productName = AJSITunesAPI; 176 | productReference = A194BE2A17DA202C00F19CEF /* libAJSITunesAPI.a */; 177 | productType = "com.apple.product-type.library.static"; 178 | }; 179 | A194BE3917DA202C00F19CEF /* AJSITunesAPITests */ = { 180 | isa = PBXNativeTarget; 181 | buildConfigurationList = A194BE5017DA202C00F19CEF /* Build configuration list for PBXNativeTarget "AJSITunesAPITests" */; 182 | buildPhases = ( 183 | A194BE3617DA202C00F19CEF /* Sources */, 184 | A194BE3717DA202C00F19CEF /* Frameworks */, 185 | A194BE3817DA202C00F19CEF /* Resources */, 186 | ); 187 | buildRules = ( 188 | ); 189 | dependencies = ( 190 | A194BE4117DA202C00F19CEF /* PBXTargetDependency */, 191 | ); 192 | name = AJSITunesAPITests; 193 | productName = AJSITunesAPITests; 194 | productReference = A194BE3A17DA202C00F19CEF /* AJSITunesAPITests.xctest */; 195 | productType = "com.apple.product-type.bundle.unit-test"; 196 | }; 197 | /* End PBXNativeTarget section */ 198 | 199 | /* Begin PBXProject section */ 200 | A194BE2217DA202C00F19CEF /* Project object */ = { 201 | isa = PBXProject; 202 | attributes = { 203 | LastUpgradeCheck = 0500; 204 | ORGANIZATIONNAME = "Rocket Town Ltd"; 205 | }; 206 | buildConfigurationList = A194BE2517DA202C00F19CEF /* Build configuration list for PBXProject "AJSITunesAPI" */; 207 | compatibilityVersion = "Xcode 3.2"; 208 | developmentRegion = English; 209 | hasScannedForEncodings = 0; 210 | knownRegions = ( 211 | en, 212 | ); 213 | mainGroup = A194BE2117DA202C00F19CEF; 214 | productRefGroup = A194BE2B17DA202C00F19CEF /* Products */; 215 | projectDirPath = ""; 216 | projectRoot = ""; 217 | targets = ( 218 | A194BE2917DA202C00F19CEF /* AJSITunesAPI */, 219 | A194BE3917DA202C00F19CEF /* AJSITunesAPITests */, 220 | ); 221 | }; 222 | /* End PBXProject section */ 223 | 224 | /* Begin PBXResourcesBuildPhase section */ 225 | A194BE3817DA202C00F19CEF /* Resources */ = { 226 | isa = PBXResourcesBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | A194BE4817DA202C00F19CEF /* InfoPlist.strings in Resources */, 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | /* End PBXResourcesBuildPhase section */ 234 | 235 | /* Begin PBXShellScriptBuildPhase section */ 236 | 0DBBED20365E4924A71DE04F /* Check Pods Manifest.lock */ = { 237 | isa = PBXShellScriptBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | ); 241 | inputPaths = ( 242 | ); 243 | name = "Check Pods Manifest.lock"; 244 | outputPaths = ( 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | shellPath = /bin/sh; 248 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 249 | showEnvVarsInLog = 0; 250 | }; 251 | 34347E25FDC442FD90521996 /* Copy Pods Resources */ = { 252 | isa = PBXShellScriptBuildPhase; 253 | buildActionMask = 2147483647; 254 | files = ( 255 | ); 256 | inputPaths = ( 257 | ); 258 | name = "Copy Pods Resources"; 259 | outputPaths = ( 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | shellPath = /bin/sh; 263 | shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n"; 264 | showEnvVarsInLog = 0; 265 | }; 266 | /* End PBXShellScriptBuildPhase section */ 267 | 268 | /* Begin PBXSourcesBuildPhase section */ 269 | A194BE2617DA202C00F19CEF /* Sources */ = { 270 | isa = PBXSourcesBuildPhase; 271 | buildActionMask = 2147483647; 272 | files = ( 273 | A194BE5517DA221500F19CEF /* AJSITunesClient.m in Sources */, 274 | A194BE6617DA262700F19CEF /* AJSITunesResult.m in Sources */, 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | A194BE3617DA202C00F19CEF /* Sources */ = { 279 | isa = PBXSourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | A194BE4A17DA202C00F19CEF /* AJSITunesAPITests.m in Sources */, 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | }; 286 | /* End PBXSourcesBuildPhase section */ 287 | 288 | /* Begin PBXTargetDependency section */ 289 | A194BE4117DA202C00F19CEF /* PBXTargetDependency */ = { 290 | isa = PBXTargetDependency; 291 | target = A194BE2917DA202C00F19CEF /* AJSITunesAPI */; 292 | targetProxy = A194BE4017DA202C00F19CEF /* PBXContainerItemProxy */; 293 | }; 294 | /* End PBXTargetDependency section */ 295 | 296 | /* Begin PBXVariantGroup section */ 297 | A194BE4617DA202C00F19CEF /* InfoPlist.strings */ = { 298 | isa = PBXVariantGroup; 299 | children = ( 300 | A194BE4717DA202C00F19CEF /* en */, 301 | ); 302 | name = InfoPlist.strings; 303 | sourceTree = ""; 304 | }; 305 | /* End PBXVariantGroup section */ 306 | 307 | /* Begin XCBuildConfiguration section */ 308 | A194BE4B17DA202C00F19CEF /* Debug */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | ALWAYS_SEARCH_USER_PATHS = NO; 312 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 313 | CLANG_CXX_LIBRARY = "libc++"; 314 | CLANG_ENABLE_MODULES = YES; 315 | CLANG_ENABLE_OBJC_ARC = YES; 316 | CLANG_WARN_BOOL_CONVERSION = YES; 317 | CLANG_WARN_CONSTANT_CONVERSION = YES; 318 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 319 | CLANG_WARN_EMPTY_BODY = YES; 320 | CLANG_WARN_ENUM_CONVERSION = YES; 321 | CLANG_WARN_INT_CONVERSION = YES; 322 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 323 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 324 | COPY_PHASE_STRIP = NO; 325 | GCC_C_LANGUAGE_STANDARD = gnu99; 326 | GCC_DYNAMIC_NO_PIC = NO; 327 | GCC_OPTIMIZATION_LEVEL = 0; 328 | GCC_PREPROCESSOR_DEFINITIONS = ( 329 | "DEBUG=1", 330 | "$(inherited)", 331 | ); 332 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 333 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 334 | GCC_WARN_UNDECLARED_SELECTOR = YES; 335 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 336 | GCC_WARN_UNUSED_FUNCTION = YES; 337 | GCC_WARN_UNUSED_VARIABLE = YES; 338 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 339 | ONLY_ACTIVE_ARCH = YES; 340 | SDKROOT = iphoneos; 341 | }; 342 | name = Debug; 343 | }; 344 | A194BE4C17DA202C00F19CEF /* Release */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ALWAYS_SEARCH_USER_PATHS = NO; 348 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 349 | CLANG_CXX_LIBRARY = "libc++"; 350 | CLANG_ENABLE_MODULES = YES; 351 | CLANG_ENABLE_OBJC_ARC = YES; 352 | CLANG_WARN_BOOL_CONVERSION = YES; 353 | CLANG_WARN_CONSTANT_CONVERSION = YES; 354 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 355 | CLANG_WARN_EMPTY_BODY = YES; 356 | CLANG_WARN_ENUM_CONVERSION = YES; 357 | CLANG_WARN_INT_CONVERSION = YES; 358 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | COPY_PHASE_STRIP = YES; 361 | ENABLE_NS_ASSERTIONS = NO; 362 | GCC_C_LANGUAGE_STANDARD = gnu99; 363 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 364 | GCC_WARN_UNDECLARED_SELECTOR = YES; 365 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 366 | GCC_WARN_UNUSED_FUNCTION = YES; 367 | GCC_WARN_UNUSED_VARIABLE = YES; 368 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 369 | SDKROOT = iphoneos; 370 | VALIDATE_PRODUCT = YES; 371 | }; 372 | name = Release; 373 | }; 374 | A194BE4E17DA202C00F19CEF /* Debug */ = { 375 | isa = XCBuildConfiguration; 376 | baseConfigurationReference = 05B21F86938C4806990CD064 /* Pods.xcconfig */; 377 | buildSettings = { 378 | DSTROOT = /tmp/AJSITunesAPI.dst; 379 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 380 | GCC_PREFIX_HEADER = "AJSITunesAPI/AJSITunesAPI-Prefix.pch"; 381 | OTHER_LDFLAGS = "-ObjC"; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | SKIP_INSTALL = YES; 384 | }; 385 | name = Debug; 386 | }; 387 | A194BE4F17DA202C00F19CEF /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | baseConfigurationReference = 05B21F86938C4806990CD064 /* Pods.xcconfig */; 390 | buildSettings = { 391 | DSTROOT = /tmp/AJSITunesAPI.dst; 392 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 393 | GCC_PREFIX_HEADER = "AJSITunesAPI/AJSITunesAPI-Prefix.pch"; 394 | OTHER_LDFLAGS = "-ObjC"; 395 | PRODUCT_NAME = "$(TARGET_NAME)"; 396 | SKIP_INSTALL = YES; 397 | }; 398 | name = Release; 399 | }; 400 | A194BE5117DA202C00F19CEF /* Debug */ = { 401 | isa = XCBuildConfiguration; 402 | buildSettings = { 403 | FRAMEWORK_SEARCH_PATHS = ( 404 | "$(SDKROOT)/Developer/Library/Frameworks", 405 | "$(inherited)", 406 | "$(SYSTEM_APPS_DIR)/Xcode5-DP.app/Contents/Developer/Library/Frameworks", 407 | ); 408 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 409 | GCC_PREFIX_HEADER = "AJSITunesAPI/AJSITunesAPI-Prefix.pch"; 410 | GCC_PREPROCESSOR_DEFINITIONS = ( 411 | "DEBUG=1", 412 | "$(inherited)", 413 | ); 414 | INFOPLIST_FILE = "AJSITunesAPITests/AJSITunesAPITests-Info.plist"; 415 | PRODUCT_NAME = "$(TARGET_NAME)"; 416 | WRAPPER_EXTENSION = xctest; 417 | }; 418 | name = Debug; 419 | }; 420 | A194BE5217DA202C00F19CEF /* Release */ = { 421 | isa = XCBuildConfiguration; 422 | buildSettings = { 423 | FRAMEWORK_SEARCH_PATHS = ( 424 | "$(SDKROOT)/Developer/Library/Frameworks", 425 | "$(inherited)", 426 | "$(SYSTEM_APPS_DIR)/Xcode5-DP.app/Contents/Developer/Library/Frameworks", 427 | ); 428 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 429 | GCC_PREFIX_HEADER = "AJSITunesAPI/AJSITunesAPI-Prefix.pch"; 430 | INFOPLIST_FILE = "AJSITunesAPITests/AJSITunesAPITests-Info.plist"; 431 | PRODUCT_NAME = "$(TARGET_NAME)"; 432 | WRAPPER_EXTENSION = xctest; 433 | }; 434 | name = Release; 435 | }; 436 | /* End XCBuildConfiguration section */ 437 | 438 | /* Begin XCConfigurationList section */ 439 | A194BE2517DA202C00F19CEF /* Build configuration list for PBXProject "AJSITunesAPI" */ = { 440 | isa = XCConfigurationList; 441 | buildConfigurations = ( 442 | A194BE4B17DA202C00F19CEF /* Debug */, 443 | A194BE4C17DA202C00F19CEF /* Release */, 444 | ); 445 | defaultConfigurationIsVisible = 0; 446 | defaultConfigurationName = Release; 447 | }; 448 | A194BE4D17DA202C00F19CEF /* Build configuration list for PBXNativeTarget "AJSITunesAPI" */ = { 449 | isa = XCConfigurationList; 450 | buildConfigurations = ( 451 | A194BE4E17DA202C00F19CEF /* Debug */, 452 | A194BE4F17DA202C00F19CEF /* Release */, 453 | ); 454 | defaultConfigurationIsVisible = 0; 455 | defaultConfigurationName = Release; 456 | }; 457 | A194BE5017DA202C00F19CEF /* Build configuration list for PBXNativeTarget "AJSITunesAPITests" */ = { 458 | isa = XCConfigurationList; 459 | buildConfigurations = ( 460 | A194BE5117DA202C00F19CEF /* Debug */, 461 | A194BE5217DA202C00F19CEF /* Release */, 462 | ); 463 | defaultConfigurationIsVisible = 0; 464 | defaultConfigurationName = Release; 465 | }; 466 | /* End XCConfigurationList section */ 467 | }; 468 | rootObject = A194BE2217DA202C00F19CEF /* Project object */; 469 | } 470 | -------------------------------------------------------------------------------- /AJSITunesAPI.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AJSITunesAPI.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AJSITunesAPI.xcworkspace/xcshareddata/AJSITunesAPI.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectIdentifier 6 | F50F244B-7538-47F0-8815-6BA53065176A 7 | IDESourceControlProjectName 8 | AJSITunesAPI 9 | IDESourceControlProjectOriginsDictionary 10 | 11 | A2602D75-36E5-4CE6-B1F8-52F0863ED6A6 12 | https://github.com/andysmart/AJS-iTunes-API.git 13 | 14 | IDESourceControlProjectPath 15 | AJSITunesAPI.xcworkspace 16 | IDESourceControlProjectRelativeInstallPathDictionary 17 | 18 | A2602D75-36E5-4CE6-B1F8-52F0863ED6A6 19 | .. 20 | 21 | IDESourceControlProjectURL 22 | https://github.com/andysmart/AJS-iTunes-API.git 23 | IDESourceControlProjectVersion 24 | 110 25 | IDESourceControlProjectWCCIdentifier 26 | A2602D75-36E5-4CE6-B1F8-52F0863ED6A6 27 | IDESourceControlProjectWCConfigurations 28 | 29 | 30 | IDESourceControlRepositoryExtensionIdentifierKey 31 | public.vcs.git 32 | IDESourceControlWCCIdentifierKey 33 | A2602D75-36E5-4CE6-B1F8-52F0863ED6A6 34 | IDESourceControlWCCName 35 | AJS-iTunes-API 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /AJSITunesAPI/AJSITunesAPI-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /AJSITunesAPI/AJSITunesAPI.h: -------------------------------------------------------------------------------- 1 | // 2 | // AJSITunesAPI.h 3 | // AJSITunesAPI 4 | // 5 | // Created by Andy Smart on 06/09/2013. 6 | // Copyright (c) 2013 Rocket Town Ltd. All rights reserved. 7 | // 8 | 9 | #import "AJSITunesClient.h" 10 | #import "AJSITunesResult.h" -------------------------------------------------------------------------------- /AJSITunesAPI/AJSITunesClient.h: -------------------------------------------------------------------------------- 1 | // 2 | // AJSITunesHTTPClient.h 3 | // AJSITunesAPI 4 | // 5 | // Created by Andy Smart on 06/09/2013. 6 | // Copyright (c) 2013 Rocket Town Ltd. All rights reserved. 7 | // 8 | 9 | #import "AFHTTPSessionManager.h" 10 | 11 | typedef void (^AJSITunesCompletionBlock)(NSArray *results, NSError *error); 12 | 13 | @interface AJSITunesClient : AFHTTPSessionManager 14 | 15 | + (AJSITunesClient *)sharedClient; 16 | - (id) searchMedia:(NSString *)keywords completion:(AJSITunesCompletionBlock)completion; 17 | 18 | - (id) searchMediaWithType:(NSString *)type 19 | keywords:(NSString *)keywords 20 | country:(NSString *)countryCode 21 | limit:(NSUInteger)limit 22 | completion:(AJSITunesCompletionBlock)completion; 23 | 24 | - (id) searchMediaWithType:(NSString *)type 25 | entityType:(NSString *)entityType 26 | attribute:(NSString *)attribute 27 | keywords:(NSString *)keywords 28 | country:(NSString *)countryCode 29 | limit:(NSUInteger)limit 30 | completion:(AJSITunesCompletionBlock)completion; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /AJSITunesAPI/AJSITunesClient.m: -------------------------------------------------------------------------------- 1 | // 2 | // AJSITunesHTTPClient.m 3 | // AJSITunesAPI 4 | // 5 | // Created by Andy Smart on 06/09/2013. 6 | // Copyright (c) 2013 Rocket Town Ltd. All rights reserved. 7 | // 8 | 9 | #import "AJSITunesClient.h" 10 | #import "AJSITunesResult.h" 11 | 12 | #define BASE_URL @"http://itunes.apple.com/" 13 | 14 | @implementation AJSITunesClient 15 | 16 | + (AJSITunesClient *)sharedClient 17 | { 18 | static AJSITunesClient *_sharedClient = nil; 19 | static dispatch_once_t onceToken; 20 | dispatch_once(&onceToken, ^{ 21 | NSURL *url = [NSURL URLWithString:BASE_URL]; 22 | _sharedClient = [[self alloc] initWithBaseURL:url]; 23 | _sharedClient.responseSerializer = [AFJSONResponseSerializer serializer]; 24 | }); 25 | 26 | return _sharedClient; 27 | } 28 | 29 | #pragma mark - Convenience 30 | 31 | - (id) searchMedia:(NSString *)keywords completion:(AJSITunesCompletionBlock)completion 32 | { 33 | return [self searchMediaWithType:AJSITunesMediaTypeAll keywords:keywords country:@"US" limit:50 completion:completion]; 34 | } 35 | 36 | - (id) searchMediaWithType:(NSString *)type 37 | keywords:(NSString *)keywords 38 | country:(NSString *)countryCode 39 | limit:(NSUInteger)limit 40 | completion:(AJSITunesCompletionBlock)completion 41 | { 42 | return [self searchMediaWithType:type entityType:nil attribute:nil keywords:keywords country:countryCode limit:limit completion:completion]; 43 | } 44 | 45 | - (id) searchMediaWithType:(NSString *)type 46 | entityType:(NSString *)entityType 47 | attribute:(NSString *)attribute 48 | keywords:(NSString *)keywords 49 | country:(NSString *)countryCode 50 | limit:(NSUInteger)limit 51 | completion:(AJSITunesCompletionBlock)completion 52 | { 53 | if (!type) { 54 | type = AJSITunesMediaTypeAll; 55 | } 56 | 57 | NSMutableDictionary *params = [NSMutableDictionary dictionary]; 58 | [params setObject:keywords forKey:@"term"]; 59 | [params setObject:type forKey:@"media"]; 60 | 61 | if (countryCode) { 62 | [params setObject:countryCode forKey:@"country"]; 63 | } 64 | if (entityType) { 65 | [params setObject:entityType forKey:@"entity"]; 66 | } 67 | if (attribute) { 68 | [params setObject:attribute forKey:@"attribute"]; 69 | } 70 | 71 | [params setObject:@(limit) forKey:@"limit"]; 72 | 73 | return [self GET:@"search" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) { 74 | 75 | NSArray *results = responseObject[@"results"]; 76 | NSMutableArray *objects = [NSMutableArray arrayWithCapacity:[results count]]; 77 | 78 | for (NSDictionary *hash in results) { 79 | NSError *error = nil; 80 | AJSITunesResult *object = [MTLJSONAdapter modelOfClass:[AJSITunesResult class] fromJSONDictionary:hash error:&error]; 81 | 82 | if (object && !error) { 83 | [objects addObject:object]; 84 | } else { 85 | NSLog(@"Error processing object with hash: %@", hash); 86 | } 87 | } 88 | 89 | if (completion) completion(objects, nil); 90 | 91 | } failure:^(NSURLSessionDataTask *task, NSError *error) { 92 | if (completion) completion(nil, error); 93 | }]; 94 | } 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /AJSITunesAPI/AJSITunesResult.h: -------------------------------------------------------------------------------- 1 | // 2 | // AJSITunesResult.h 3 | // AJSITunesAPI 4 | // 5 | // Created by Andy Smart on 06/09/2013. 6 | // Copyright (c) 2013 Rocket Town Ltd. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString *const AJSITunesMediaTypeAll; 12 | extern NSString *const AJSITunesMediaTypeMusic; 13 | extern NSString *const AJSITunesMediaTypeMovie; 14 | extern NSString *const AJSITunesMediaTypeMusicVideo; 15 | extern NSString *const AJSITunesMediaTypeTVShow; 16 | extern NSString *const AJSITunesMediaTypeAudiobook; 17 | extern NSString *const AJSITunesMediaTypeEBook; 18 | extern NSString *const AJSITunesMediaTypePodcast; 19 | extern NSString *const AJSITunesMediaTypeShortFilm; 20 | extern NSString *const AJSITunesMediaTypeSoftware; 21 | 22 | extern NSString *const AJSITunesEntityTypeAlbum; 23 | extern NSString *const AJSITunesEntityTypeAllArtist; 24 | extern NSString *const AJSITunesEntityTypeAllTrack; 25 | extern NSString *const AJSITunesEntityTypeAudiobook; 26 | extern NSString *const AJSITunesEntityTypeAudiobookAuthor; 27 | extern NSString *const AJSITunesEntityTypeEbook; 28 | extern NSString *const AJSITunesEntityTypeIPadSoftware; 29 | extern NSString *const AJSITunesEntityTypeMacSoftware; 30 | extern NSString *const AJSITunesEntityTypeMix; 31 | extern NSString *const AJSITunesEntityTypeMovie; 32 | extern NSString *const AJSITunesEntityTypeMovieArtist; 33 | extern NSString *const AJSITunesEntityTypeMusicTrack; 34 | extern NSString *const AJSITunesEntityTypeMusicVideo; 35 | extern NSString *const AJSITunesEntityTypePodcast; 36 | extern NSString *const AJSITunesEntityTypePodcastAuthor; 37 | extern NSString *const AJSITunesEntityTypeShortFilm; 38 | extern NSString *const AJSITunesEntityTypeShortFilmArtist; 39 | extern NSString *const AJSITunesEntityTypeSoftware; 40 | extern NSString *const AJSITunesEntityTypeSong; 41 | extern NSString *const AJSITunesEntityTypeTvEpisode; 42 | extern NSString *const AJSITunesEntityTypeTvSeason; 43 | 44 | extern NSString *const AJSITunesAttributeAlbumTerm; 45 | extern NSString *const AJSITunesAttributeAllArtistTerm; 46 | extern NSString *const AJSITunesAttributeAllTrackTerm; 47 | extern NSString *const AJSITunesAttributeArtistTerm; 48 | extern NSString *const AJSITunesAttributeAuthorTerm; 49 | extern NSString *const AJSITunesAttributeComposerTerm; 50 | extern NSString *const AJSITunesAttributeDescriptionTerm; 51 | extern NSString *const AJSITunesAttributeDirectorTerm; 52 | extern NSString *const AJSITunesAttributeFeatureFilmTerm; 53 | extern NSString *const AJSITunesAttributeGenreIndex; 54 | extern NSString *const AJSITunesAttributeKeywordsTerm; 55 | extern NSString *const AJSITunesAttributeLanguageTerm; 56 | extern NSString *const AJSITunesAttributeMixTerm; 57 | extern NSString *const AJSITunesAttributeMovieArtistTerm; 58 | extern NSString *const AJSITunesAttributeMovieTerm; 59 | extern NSString *const AJSITunesAttributeProducerTerm; 60 | extern NSString *const AJSITunesAttributeRatingIndex; 61 | extern NSString *const AJSITunesAttributeRatingTerm; 62 | extern NSString *const AJSITunesAttributeReleaseYearTerm; 63 | extern NSString *const AJSITunesAttributeShortFilmTerm; 64 | extern NSString *const AJSITunesAttributeShowTerm; 65 | extern NSString *const AJSITunesAttributeSoftwareDeveloper; 66 | extern NSString *const AJSITunesAttributeSongTerm; 67 | extern NSString *const AJSITunesAttributeTitleTerm; 68 | extern NSString *const AJSITunesAttributeTvEpisodeTerm; 69 | extern NSString *const AJSITunesAttributeTvSeasonTerm; 70 | 71 | @interface AJSITunesResult : MTLModel 72 | 73 | @property (nonatomic, strong, readonly) NSNumber *itemID; 74 | @property (nonatomic, strong, readonly) NSNumber *artistID; 75 | 76 | @property (nonatomic, strong, readonly) NSNumber *trackCount; 77 | @property (nonatomic, strong, readonly) NSNumber *trackNumber; 78 | 79 | @property (nonatomic, strong, readonly) NSString *mediaType; 80 | 81 | //Title: Either track title, episode name, or item title (software) 82 | 83 | @property (nonatomic, strong, readonly) NSString *title; 84 | 85 | //Artist name: For film this is often lead actor / director 86 | 87 | @property (nonatomic, strong, readonly) NSString *artistName; 88 | @property (nonatomic, strong, readonly) NSDate *releaseDate; 89 | 90 | //Path to the full fat image, may or may not exist 91 | 92 | @property (nonatomic, strong, readonly) NSURL *imageURL; 93 | @property (nonatomic, strong, readonly) NSURL *thumnailImageURL; 94 | @property (nonatomic, strong, readonly) NSURL *previewURL; 95 | @property (nonatomic, strong, readonly) NSURL *viewURL; 96 | 97 | //Collection name: usually the album name (music) 98 | 99 | @property (nonatomic, strong, readonly) NSString *collectionName; 100 | @property (nonatomic, strong, readonly) NSString *genreName; 101 | 102 | @property (nonatomic, strong, readonly) NSString *itemDescription; 103 | 104 | @property (nonatomic, strong, readonly) NSNumber *duration; 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /AJSITunesAPI/AJSITunesResult.m: -------------------------------------------------------------------------------- 1 | // 2 | // AJSITunesResult.m 3 | // AJSITunesAPI 4 | // 5 | // Created by Andy Smart on 06/09/2013. 6 | // Copyright (c) 2013 Rocket Town Ltd. All rights reserved. 7 | // 8 | 9 | #import "AJSITunesResult.h" 10 | #import 11 | 12 | NSString *const AJSITunesMediaTypeAll = @"all"; 13 | NSString *const AJSITunesMediaTypeMusic = @"music"; 14 | NSString *const AJSITunesMediaTypeMovie = @"movie"; 15 | NSString *const AJSITunesMediaTypeMusicVideo = @"musicVideo"; 16 | NSString *const AJSITunesMediaTypeTVShow = @"tvShow"; 17 | NSString *const AJSITunesMediaTypeAudiobook = @"audiobook"; 18 | NSString *const AJSITunesMediaTypeEBook = @"ebook"; 19 | NSString *const AJSITunesMediaTypePodcast = @"podcast"; 20 | NSString *const AJSITunesMediaTypeShortFilm = @"shortFilm"; 21 | NSString *const AJSITunesMediaTypeSoftware = @"software"; 22 | 23 | NSString *const AJSITunesEntityTypeAlbum = @"album"; 24 | NSString *const AJSITunesEntityTypeAllArtist = @"allArtist"; 25 | NSString *const AJSITunesEntityTypeAllTrack = @"allTrack"; 26 | NSString *const AJSITunesEntityTypeAudiobook = @"audiobook"; 27 | NSString *const AJSITunesEntityTypeAudiobookAuthor = @"audiobookAuthor"; 28 | NSString *const AJSITunesEntityTypeEbook = @"ebook"; 29 | NSString *const AJSITunesEntityTypeIPadSoftware = @"iPadSoftware"; 30 | NSString *const AJSITunesEntityTypeMacSoftware = @"software"; 31 | NSString *const AJSITunesEntityTypeMix = @"mix"; 32 | NSString *const AJSITunesEntityTypeMovie = @"movie"; 33 | NSString *const AJSITunesEntityTypeMovieArtist = @"movieArtist"; 34 | NSString *const AJSITunesEntityTypeMusicTrack = @"musicTrack"; 35 | NSString *const AJSITunesEntityTypeMusicVideo = @"musicVideo"; 36 | NSString *const AJSITunesEntityTypePodcast = @"podcast"; 37 | NSString *const AJSITunesEntityTypePodcastAuthor = @"podcastAutor"; 38 | NSString *const AJSITunesEntityTypeShortFilm = @"shortFilm"; 39 | NSString *const AJSITunesEntityTypeShortFilmArtist = @"shortFilmArtist"; 40 | NSString *const AJSITunesEntityTypeSoftware = @"software"; 41 | NSString *const AJSITunesEntityTypeSong = @"song"; 42 | NSString *const AJSITunesEntityTypeTvEpisode = @"tvEpisode"; 43 | NSString *const AJSITunesEntityTypeTvSeason = @"tvSeason"; 44 | 45 | NSString *const AJSITunesAttributeAlbumTerm = @"albumTerm"; 46 | NSString *const AJSITunesAttributeAllArtistTerm = @"allArtistTerm"; 47 | NSString *const AJSITunesAttributeAllTrackTerm = @"allTrackTerm"; 48 | NSString *const AJSITunesAttributeArtistTerm = @"artistTerm"; 49 | NSString *const AJSITunesAttributeAuthorTerm = @"authorTerm"; 50 | NSString *const AJSITunesAttributeComposerTerm = @"composerTerm"; 51 | NSString *const AJSITunesAttributeDescriptionTerm = @"descriptionTerm"; 52 | NSString *const AJSITunesAttributeDirectorTerm = @"directorTerm"; 53 | NSString *const AJSITunesAttributeFeatureFilmTerm = @"featureFilmTerm"; 54 | NSString *const AJSITunesAttributeGenreIndex = @"genreIndex"; 55 | NSString *const AJSITunesAttributeKeywordsTerm = @"keywordsTerm"; 56 | NSString *const AJSITunesAttributeLanguageTerm = @"languageTerm"; 57 | NSString *const AJSITunesAttributeMixTerm = @"mixTerm"; 58 | NSString *const AJSITunesAttributeMovieArtistTerm = @"movieArtistTerm"; 59 | NSString *const AJSITunesAttributeMovieTerm = @"movieTerm"; 60 | NSString *const AJSITunesAttributeProducerTerm = @"producerTerm"; 61 | NSString *const AJSITunesAttributeRatingIndex = @"ratingIndex"; 62 | NSString *const AJSITunesAttributeRatingTerm = @"ratingTerm"; 63 | NSString *const AJSITunesAttributeReleaseYearTerm = @"releaseYearTerm"; 64 | NSString *const AJSITunesAttributeShortFilmTerm = @"shortFilmTerm"; 65 | NSString *const AJSITunesAttributeShowTerm = @"showTerm"; 66 | NSString *const AJSITunesAttributeSoftwareDeveloper = @"softwareDeveloper"; 67 | NSString *const AJSITunesAttributeSongTerm = @"songTerm"; 68 | NSString *const AJSITunesAttributeTitleTerm = @"titleTerm"; 69 | NSString *const AJSITunesAttributeTvEpisodeTerm = @"tvEpisodeTerm"; 70 | NSString *const AJSITunesAttributeTvSeasonTerm = @"tvSeasonTerm"; 71 | 72 | @interface AJSITunesResult() 73 | @property (nonatomic, strong) NSString *imageURLString; 74 | @end 75 | 76 | @implementation AJSITunesResult 77 | 78 | + (ISO8601DateFormatter *)dateFormatter 79 | { 80 | ISO8601DateFormatter *formatter = [[ISO8601DateFormatter alloc] init]; 81 | return formatter; 82 | } 83 | 84 | #pragma mark - Images 85 | 86 | - (NSURL *)imageURL 87 | { 88 | NSString *stripped = [self.imageURLString stringByReplacingOccurrencesOfString:@"100x100-75." withString:@""]; 89 | return [NSURL URLWithString:stripped]; 90 | } 91 | 92 | - (NSURL *)thumnailImageURL 93 | { 94 | return [NSURL URLWithString:self.imageURLString]; 95 | } 96 | 97 | #pragma mark - JSON Serialization 98 | 99 | + (NSDictionary *)JSONKeyPathsByPropertyKey 100 | { 101 | return @{ @"itemID" : @"trackId", 102 | @"artistID" : @"artistId", 103 | @"trackCount" : @"trackCount", 104 | @"trackNumber" : @"trackNumber", 105 | @"title" : @"trackName", 106 | @"artistName" : @"artistName", 107 | @"genreName" : @"primaryGenreName", 108 | @"collectionName" : @"collectionName", 109 | @"mediaType" : @"kind", 110 | @"itemDescription" : @"longDescription", 111 | @"previewURL" : @"previewUrl", 112 | @"viewURL" : @"trackViewUrl", 113 | @"duration" : @"trackTimeMillis", 114 | @"releaseDate" : @"releaseDate", 115 | @"imageURLString" : @"artworkUrl100", 116 | }; 117 | } 118 | 119 | 120 | + (NSValueTransformer *)previewURLValueTransformer 121 | { 122 | return [NSValueTransformer valueTransformerForName:MTLURLValueTransformerName]; 123 | } 124 | 125 | + (NSValueTransformer *)viewURLValueTransformer 126 | { 127 | return [NSValueTransformer valueTransformerForName:MTLURLValueTransformerName]; 128 | } 129 | 130 | + (NSValueTransformer *)releaseDateValueTransformer 131 | { 132 | return [MTLValueTransformer reversibleTransformerWithForwardBlock:^(NSString *str) { 133 | return [[self dateFormatter] dateFromString:str]; 134 | } reverseBlock:^(NSDate *date) { 135 | return [[self dateFormatter] stringFromDate:date]; 136 | }];; 137 | } 138 | 139 | @end 140 | -------------------------------------------------------------------------------- /AJSITunesAPITests/AJSITunesAPITests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | co.rockettown.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /AJSITunesAPITests/AJSITunesAPITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // AJSITunesAPITests.m 3 | // AJSITunesAPITests 4 | // 5 | // Created by Andy Smart on 06/09/2013. 6 | // Copyright (c) 2013 Rocket Town Ltd. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AJSITunesAPITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation AJSITunesAPITests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | 21 | // Set-up code here. 22 | } 23 | 24 | - (void)tearDown 25 | { 26 | // Tear-down code here. 27 | 28 | [super tearDown]; 29 | } 30 | 31 | - (void)testExample 32 | { 33 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /AJSITunesAPITests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Andy Smart 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '7.0' 2 | 3 | pod 'AJSITunesAPI', :git => 'https://github.com/andysmart/AJS-iTunes-API' 4 | 5 | inhibit_all_warnings! -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (2.0.0-RC2): 3 | - AFNetworking/Core 4 | - AFNetworking/UIKit+AFNetworking 5 | - AFNetworking/Core (2.0.0-RC2) 6 | - AFNetworking/UIKit+AFNetworking (2.0.0-RC2) 7 | - ISO8601DateFormatter (0.6) 8 | - Mantle (1.2): 9 | - Mantle/extobjc 10 | - Mantle/extobjc (1.2) 11 | 12 | DEPENDENCIES: 13 | - AFNetworking (~> 2.0.0-RC2) 14 | - ISO8601DateFormatter (~> 0.6) 15 | - Mantle (~> 1.2) 16 | 17 | SPEC CHECKSUMS: 18 | AFNetworking: 6b19d8a0793f342d8c879cd0af9d7488e54addcf 19 | ISO8601DateFormatter: 077ce9d8cfba171bc1ced6cba0d2ae4aefab7619 20 | Mantle: f5b5cba1b112273fe3bb4433cdcf1da76203c2b4 21 | 22 | COCOAPODS: 0.23.0 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | AJS iTunesAPI 2 | ============= 3 | 4 | AJSiTunesAPI is a simple, asynchronous Cocoa API controller and object for searching the iTunes Search API on either Mac OSX or iOS projects. 5 | 6 | This library is a work-in-progress, but current features should work as expected. Support for iTunes lookups from artist ID is omitted, and planned. 7 | 8 | ### Requirements 9 | 10 | AJSITunesAPI 0.2.0 uses the latest version of AFNetworking, and as a result is compatible only with project supporting iOS7, or OSX 10.9 Mavericks. 11 | 12 | ### Documentation 13 | 14 | For a rundown of the type of results to expect, source documentation of the API can be found here: http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html 15 | 16 | Results are parsed to Cocoa objects, with properties for most of the returned data. Check the header files for data types and properties supported. 17 | 18 | Installation 19 | ============ 20 | 21 | Installation is super easy, using Cocoapods. Just add the `pod 'AJSITunesAPI', :git => 'https://github.com/andysmart/AJS-iTunes-API'` to your `Podfile` and run `pod install`. 22 | 23 | Usage 24 | ===== 25 | 26 | AJSITunesAPI is now fully block based, and much simpler as a result. Use one of the two convenience methods on `AJSITunesClient`, and receive an `NSArray` of `AJSITunesResult` objects. 27 | 28 | ```objective-c 29 | AJSITunesClient *client = [AJSITunesClient sharedClient]; 30 | [client searchMedia:@"batman" completion:^(NSArray *results, NSError *error) { 31 | NSLog(@"Finished with results: %@", results); 32 | }]; 33 | ``` 34 | 35 | Or, if you need a bit more control: 36 | 37 | ```objective-c 38 | AJSITunesClient *client = [AJSITunesClient sharedClient]; 39 | [client searchMediaWithType:AJSITunesMediaTypeMovie 40 | keywords:@"batman" 41 | country:@"US" 42 | limit:10 43 | completion:(NSArray *results, NSError *error) { 44 | NSLog(@"Finished with results: %@", results); 45 | }]; 46 | ``` 47 | 48 | License 49 | ============ 50 | 51 | Standard MIT deal, see LICENSE for details. 52 | --------------------------------------------------------------------------------