├── README.md ├── Pods ├── Headers │ ├── FMDB │ │ ├── FMDB.h │ │ ├── FMDatabase.h │ │ ├── FMResultSet.h │ │ ├── FMDatabasePool.h │ │ ├── FMDatabaseQueue.h │ │ └── FMDatabaseAdditions.h │ ├── Reachability │ │ └── Reachability.h │ ├── AFNetworking │ │ ├── AFNetworking.h │ │ ├── AFSecurityPolicy.h │ │ ├── AFHTTPSessionManager.h │ │ ├── AFURLSessionManager.h │ │ ├── AFHTTPRequestOperation.h │ │ ├── UIKit+AFNetworking.h │ │ ├── AFURLConnectionOperation.h │ │ ├── AFURLRequestSerialization.h │ │ ├── UIButton+AFNetworking.h │ │ ├── UIWebView+AFNetworking.h │ │ ├── AFNetworkReachabilityManager.h │ │ ├── AFURLResponseSerialization.h │ │ ├── UIAlertView+AFNetworking.h │ │ ├── UIImageView+AFNetworking.h │ │ ├── AFHTTPRequestOperationManager.h │ │ ├── UIProgressView+AFNetworking.h │ │ ├── UIRefreshControl+AFNetworking.h │ │ ├── AFNetworkActivityIndicatorManager.h │ │ └── UIActivityIndicatorView+AFNetworking.h │ └── SVProgressHUD │ │ └── SVProgressHUD.h ├── BuildHeaders │ ├── FMDB │ │ ├── FMDB.h │ │ ├── FMDatabase.h │ │ ├── FMResultSet.h │ │ ├── FMDatabasePool.h │ │ ├── FMDatabaseQueue.h │ │ └── FMDatabaseAdditions.h │ ├── Reachability │ │ └── Reachability.h │ ├── AFNetworking │ │ ├── AFNetworking.h │ │ ├── AFSecurityPolicy.h │ │ ├── AFHTTPSessionManager.h │ │ ├── AFURLSessionManager.h │ │ ├── AFHTTPRequestOperation.h │ │ ├── UIKit+AFNetworking.h │ │ ├── AFURLConnectionOperation.h │ │ ├── AFURLRequestSerialization.h │ │ ├── UIButton+AFNetworking.h │ │ ├── UIWebView+AFNetworking.h │ │ ├── AFNetworkReachabilityManager.h │ │ ├── AFURLResponseSerialization.h │ │ ├── UIAlertView+AFNetworking.h │ │ ├── UIImageView+AFNetworking.h │ │ ├── AFHTTPRequestOperationManager.h │ │ ├── UIProgressView+AFNetworking.h │ │ ├── UIRefreshControl+AFNetworking.h │ │ ├── AFNetworkActivityIndicatorManager.h │ │ └── UIActivityIndicatorView+AFNetworking.h │ └── SVProgressHUD │ │ └── SVProgressHUD.h ├── Pods-FMDB.xcconfig ├── Pods-SVProgressHUD.xcconfig ├── Pods-Reachability.xcconfig ├── Pods-FMDB-prefix.pch ├── Pods-AFNetworking-prefix.pch ├── Pods-Reachability-prefix.pch ├── Pods-SVProgressHUD-prefix.pch ├── Pods-dummy.m ├── Pods-FMDB-dummy.m ├── Pods-AFNetworking.xcconfig ├── FMDB │ ├── src │ │ └── fmdb │ │ │ ├── FMDB.h │ │ │ ├── FMDatabasePool.h │ │ │ ├── FMDatabaseQueue.h │ │ │ ├── FMDatabaseQueue.m │ │ │ └── FMDatabaseAdditions.m │ └── LICENSE.txt ├── Pods-AFNetworking-dummy.m ├── Pods-Reachability-dummy.m ├── SVProgressHUD │ ├── SVProgressHUD │ │ ├── SVProgressHUD.bundle │ │ │ ├── error.png │ │ │ ├── error@2x.png │ │ │ ├── success.png │ │ │ ├── error-black.png │ │ │ ├── success@2x.png │ │ │ ├── error-black@2x.png │ │ │ ├── success-black.png │ │ │ └── success-black@2x.png │ │ └── SVProgressHUD.h │ ├── LICENSE.txt │ └── README.md ├── Pods-SVProgressHUD-dummy.m ├── Pods-FMDB-Private.xcconfig ├── Pods-AFNetworking-Private.xcconfig ├── Pods-Reachability-Private.xcconfig ├── Pods-SVProgressHUD-Private.xcconfig ├── Pods.xcconfig ├── AFNetworking │ ├── LICENSE │ ├── UIKit+AFNetworking │ │ ├── UIKit+AFNetworking.h │ │ ├── UIRefreshControl+AFNetworking.h │ │ ├── UIActivityIndicatorView+AFNetworking.h │ │ ├── UIProgressView+AFNetworking.h │ │ ├── AFNetworkActivityIndicatorManager.h │ │ ├── UIRefreshControl+AFNetworking.m │ │ ├── UIActivityIndicatorView+AFNetworking.m │ │ ├── UIAlertView+AFNetworking.h │ │ ├── UIWebView+AFNetworking.h │ │ ├── UIAlertView+AFNetworking.m │ │ ├── UIWebView+AFNetworking.m │ │ ├── AFNetworkActivityIndicatorManager.m │ │ └── UIImageView+AFNetworking.h │ └── AFNetworking │ │ ├── AFNetworking.h │ │ ├── AFHTTPRequestOperation.h │ │ └── AFSecurityPolicy.h ├── Reachability │ ├── LICENCE.txt │ ├── README.md │ └── Reachability.h ├── Manifest.lock ├── Pods-environment.h ├── Pods-resources.sh ├── Pods-acknowledgements.markdown └── Pods-acknowledgements.plist ├── RTLibrary-ios ├── en.lproj │ └── InfoPlist.strings ├── LoginView.h ├── UserEntity.m ├── LoginHandler.m ├── UserEntity.h ├── BaseViewController.h ├── LoginViewController.h ├── BaseDao.h ├── AppDelegate.h ├── RTJSONResponseSerializerWithData.h ├── main.m ├── APIConfig.h ├── BaseHandler.m ├── LoginStorage.h ├── BaseDao.m ├── LoginHandler.h ├── UserDefaultsUtils.h ├── LoginViewController.m ├── LoginStorage.m ├── LoginView.m ├── RTLibrary-ios-Prefix.pch ├── BaseHandler.h ├── BaseViewController.m ├── BaseEntity.h ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── RTJSONResponseSerializerWithData.m ├── Constants.h ├── UserDefaultsUtils.m ├── RTDatabaseHelper.h ├── RTLibrary-ios-Info.plist ├── AppUtils.h ├── RTHttpClient.h ├── AppDelegate.m ├── BaseEntity.m ├── RTDatabaseHelper.m ├── BaseTableViewProtocol.h ├── BaseTableViewProtocol.m ├── RTHttpClient.m └── AppUtils.m ├── RTLibrary-iosTests ├── en.lproj │ └── InfoPlist.strings ├── RTLibrary-iosTests-Info.plist └── RTLibrary_iosTests.m ├── Podfile ├── .gitignore └── Podfile.lock /README.md: -------------------------------------------------------------------------------- 1 | RTLibrary-ios 2 | ============= 3 | -------------------------------------------------------------------------------- /Pods/Headers/FMDB/FMDB.h: -------------------------------------------------------------------------------- 1 | ../../FMDB/src/fmdb/FMDB.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/FMDB/FMDB.h: -------------------------------------------------------------------------------- 1 | ../../FMDB/src/fmdb/FMDB.h -------------------------------------------------------------------------------- /Pods/Pods-FMDB.xcconfig: -------------------------------------------------------------------------------- 1 | PODS_FMDB_OTHER_LDFLAGS = -lsqlite3 -------------------------------------------------------------------------------- /Pods/Headers/FMDB/FMDatabase.h: -------------------------------------------------------------------------------- 1 | ../../FMDB/src/fmdb/FMDatabase.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/FMDB/FMDatabase.h: -------------------------------------------------------------------------------- 1 | ../../FMDB/src/fmdb/FMDatabase.h -------------------------------------------------------------------------------- /Pods/Headers/FMDB/FMResultSet.h: -------------------------------------------------------------------------------- 1 | ../../FMDB/src/fmdb/FMResultSet.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/FMDB/FMResultSet.h: -------------------------------------------------------------------------------- 1 | ../../FMDB/src/fmdb/FMResultSet.h -------------------------------------------------------------------------------- /Pods/Headers/FMDB/FMDatabasePool.h: -------------------------------------------------------------------------------- 1 | ../../FMDB/src/fmdb/FMDatabasePool.h -------------------------------------------------------------------------------- /Pods/Headers/FMDB/FMDatabaseQueue.h: -------------------------------------------------------------------------------- 1 | ../../FMDB/src/fmdb/FMDatabaseQueue.h -------------------------------------------------------------------------------- /Pods/Headers/Reachability/Reachability.h: -------------------------------------------------------------------------------- 1 | ../../Reachability/Reachability.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/FMDB/FMDatabasePool.h: -------------------------------------------------------------------------------- 1 | ../../FMDB/src/fmdb/FMDatabasePool.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/FMDB/FMDatabaseQueue.h: -------------------------------------------------------------------------------- 1 | ../../FMDB/src/fmdb/FMDatabaseQueue.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/Reachability/Reachability.h: -------------------------------------------------------------------------------- 1 | ../../Reachability/Reachability.h -------------------------------------------------------------------------------- /Pods/Headers/FMDB/FMDatabaseAdditions.h: -------------------------------------------------------------------------------- 1 | ../../FMDB/src/fmdb/FMDatabaseAdditions.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/FMDB/FMDatabaseAdditions.h: -------------------------------------------------------------------------------- 1 | ../../FMDB/src/fmdb/FMDatabaseAdditions.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFNetworking.h -------------------------------------------------------------------------------- /Pods/Pods-SVProgressHUD.xcconfig: -------------------------------------------------------------------------------- 1 | PODS_SVPROGRESSHUD_OTHER_LDFLAGS = -framework QuartzCore -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/SVProgressHUD/SVProgressHUD.h: -------------------------------------------------------------------------------- 1 | ../../SVProgressHUD/SVProgressHUD/SVProgressHUD.h -------------------------------------------------------------------------------- /RTLibrary-ios/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Pods/BuildHeaders/SVProgressHUD/SVProgressHUD.h: -------------------------------------------------------------------------------- 1 | ../../SVProgressHUD/SVProgressHUD/SVProgressHUD.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFSecurityPolicy.h -------------------------------------------------------------------------------- /Pods/Pods-Reachability.xcconfig: -------------------------------------------------------------------------------- 1 | PODS_REACHABILITY_OTHER_LDFLAGS = -framework SystemConfiguration -------------------------------------------------------------------------------- /RTLibrary-iosTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFSecurityPolicy.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFHTTPSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFHTTPSessionManager.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFURLSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLSessionManager.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFHTTPSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFHTTPSessionManager.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFURLSessionManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLSessionManager.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFHTTPRequestOperation.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFHTTPRequestOperation.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIKit+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFHTTPRequestOperation.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIKit+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFURLConnectionOperation.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLConnectionOperation.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFURLRequestSerialization.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLRequestSerialization.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIButton+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIWebView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLConnectionOperation.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFURLRequestSerialization.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLRequestSerialization.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIButton+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIWebView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFNetworkReachabilityManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFNetworkReachabilityManager.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFURLResponseSerialization.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLResponseSerialization.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIAlertView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIImageView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFNetworkReachabilityManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFNetworkReachabilityManager.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFURLResponseSerialization.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFURLResponseSerialization.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIAlertView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFHTTPRequestOperationManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFHTTPRequestOperationManager.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIProgressView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Pods-FMDB-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-environment.h" 6 | -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperationManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/AFNetworking/AFHTTPRequestOperationManager.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIProgressView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIRefreshControl+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIRefreshControl+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Pods-AFNetworking-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-environment.h" 6 | -------------------------------------------------------------------------------- /Pods/Pods-Reachability-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-environment.h" 6 | -------------------------------------------------------------------------------- /Pods/Pods-SVProgressHUD-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-environment.h" 6 | -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h -------------------------------------------------------------------------------- /Pods/Headers/AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/BuildHeaders/AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | ../../AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h -------------------------------------------------------------------------------- /Pods/Pods-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods : NSObject 3 | @end 4 | @implementation PodsDummy_Pods 5 | @end 6 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '7.0' 2 | pod "AFNetworking", "~> 2.0" 3 | pod 'Reachability', '~> 3.1.1' 4 | pod 'SVProgressHUD', '~> 1.0' 5 | pod 'FMDB', '~> 2.3' 6 | -------------------------------------------------------------------------------- /Pods/Pods-FMDB-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_FMDB : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_FMDB 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Pods-AFNetworking.xcconfig: -------------------------------------------------------------------------------- 1 | PODS_AFNETWORKING_OTHER_LDFLAGS = -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration -------------------------------------------------------------------------------- /Pods/FMDB/src/fmdb/FMDB.h: -------------------------------------------------------------------------------- 1 | #import "FMDatabase.h" 2 | #import "FMResultSet.h" 3 | #import "FMDatabaseAdditions.h" 4 | #import "FMDatabaseQueue.h" 5 | #import "FMDatabasePool.h" 6 | -------------------------------------------------------------------------------- /Pods/Pods-AFNetworking-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_AFNetworking : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_AFNetworking 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Pods-Reachability-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Reachability : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Reachability 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangren03/RTLibrary-ios/HEAD/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error.png -------------------------------------------------------------------------------- /Pods/Pods-SVProgressHUD-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_SVProgressHUD : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_SVProgressHUD 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangren03/RTLibrary-ios/HEAD/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error@2x.png -------------------------------------------------------------------------------- /Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangren03/RTLibrary-ios/HEAD/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success.png -------------------------------------------------------------------------------- /Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangren03/RTLibrary-ios/HEAD/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error-black.png -------------------------------------------------------------------------------- /Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangren03/RTLibrary-ios/HEAD/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success@2x.png -------------------------------------------------------------------------------- /Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error-black@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangren03/RTLibrary-ios/HEAD/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error-black@2x.png -------------------------------------------------------------------------------- /Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangren03/RTLibrary-ios/HEAD/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success-black.png -------------------------------------------------------------------------------- /Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success-black@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangren03/RTLibrary-ios/HEAD/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success-black@2x.png -------------------------------------------------------------------------------- /RTLibrary-ios/LoginView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LoginView.h 3 | // RTLibrary-ios 4 | // 5 | // Created by Ryan on 14-8-3. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LoginView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RTLibrary-ios/UserEntity.m: -------------------------------------------------------------------------------- 1 | // 2 | // UserEntity.m 3 | // RTLibrary-ios 4 | // 5 | // Created by Ryan on 14-8-3. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import "UserEntity.h" 10 | 11 | @implementation UserEntity 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RTLibrary-ios/LoginHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // LoginHandler.m 3 | // RTLibrary-ios 4 | // 5 | // Created by Ryan on 14-8-3. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import "LoginHandler.h" 10 | 11 | @implementation LoginHandler 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RTLibrary-ios/UserEntity.h: -------------------------------------------------------------------------------- 1 | // 2 | // UserEntity.h 3 | // RTLibrary-ios 4 | // 5 | // Created by Ryan on 14-8-3. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import "BaseEntity.h" 10 | 11 | @interface UserEntity : BaseEntity 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RTLibrary-ios/BaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.h 3 | // zlydoc-iphone 4 | // 5 | // Created by Ryan on 14-5-23. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BaseViewController : UIViewController 12 | 13 | @end -------------------------------------------------------------------------------- /RTLibrary-ios/LoginViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LoginViewController.h 3 | // RTLibrary-ios 4 | // 5 | // Created by Ryan on 14-8-3. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface LoginViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | *.xcworkspace 13 | !default.xcworkspace 14 | xcuserdata 15 | profile 16 | *.moved-aside 17 | DerivedData 18 | .idea/ 19 | 20 | -------------------------------------------------------------------------------- /RTLibrary-ios/BaseDao.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseDao.h 3 | // ZLYDoc 4 | // https://gist.github.com/lvjian700/6113564 5 | // Created by Ryan on 14-4-15. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "RTDatabaseHelper.h" 11 | 12 | @interface BaseDao:NSObject 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /RTLibrary-ios/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // RTLibrary-ios 4 | // 5 | // Created by Ryan on 14-7-2. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /RTLibrary-ios/RTJSONResponseSerializerWithData.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTJSONResponseSerializerWithData.h 3 | // ZLYDoc 4 | // AFNetworking处理HTTP请求返回为非200(Failure Block)时获取body中json 5 | // Created by Ryan on 14-5-29. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import "AFURLResponseSerialization.h" 10 | 11 | @interface RTJSONResponseSerializerWithData : AFJSONResponseSerializer 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Pods/Pods-FMDB-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-FMDB.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/FMDB" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/FMDB" "${PODS_ROOT}/Headers/Reachability" "${PODS_ROOT}/Headers/SVProgressHUD" 4 | OTHER_LDFLAGS = -ObjC ${PODS_FMDB_OTHER_LDFLAGS} 5 | PODS_ROOT = ${SRCROOT} -------------------------------------------------------------------------------- /RTLibrary-ios/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // RTLibrary-ios 4 | // 5 | // Created by Ryan on 14-7-2. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Pods/Pods-AFNetworking-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-AFNetworking.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/AFNetworking" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/FMDB" "${PODS_ROOT}/Headers/Reachability" "${PODS_ROOT}/Headers/SVProgressHUD" 4 | OTHER_LDFLAGS = -ObjC ${PODS_AFNETWORKING_OTHER_LDFLAGS} 5 | PODS_ROOT = ${SRCROOT} -------------------------------------------------------------------------------- /Pods/Pods-Reachability-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-Reachability.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/Reachability" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/FMDB" "${PODS_ROOT}/Headers/Reachability" "${PODS_ROOT}/Headers/SVProgressHUD" 4 | OTHER_LDFLAGS = -ObjC ${PODS_REACHABILITY_OTHER_LDFLAGS} 5 | PODS_ROOT = ${SRCROOT} -------------------------------------------------------------------------------- /Pods/Pods-SVProgressHUD-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-SVProgressHUD.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/SVProgressHUD" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/FMDB" "${PODS_ROOT}/Headers/Reachability" "${PODS_ROOT}/Headers/SVProgressHUD" 4 | OTHER_LDFLAGS = -ObjC ${PODS_SVPROGRESSHUD_OTHER_LDFLAGS} 5 | PODS_ROOT = ${SRCROOT} -------------------------------------------------------------------------------- /RTLibrary-ios/APIConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // APIConfig.h 3 | // ZLYDoc 4 | // API信息 5 | // Created by Ryan on 14-4-14. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import 10 | /***************SERVER HOST***************/ 11 | 12 | #define SERVER_HOST @"192.168.1.1:3000" 13 | 14 | /***************SERVER API***************/ 15 | //登录 16 | #define API_LOGIN @"" 17 | 18 | @interface APIConfig : NSObject 19 | 20 | @end -------------------------------------------------------------------------------- /RTLibrary-ios/BaseHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseHandler.m 3 | // zlydoc-iphone 4 | // 5 | // Created by Ryan on 14-6-25. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import "BaseHandler.h" 10 | #import "APIConfig.h" 11 | 12 | @implementation BaseHandler 13 | 14 | + (NSString *)requestUrlWithPath:(NSString *)path 15 | { 16 | return [[@"http://" stringByAppendingString:[SERVER_HOST stringByAppendingString:API_VERSION]] stringByAppendingString:path]; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /RTLibrary-ios/LoginStorage.h: -------------------------------------------------------------------------------- 1 | // 2 | // LoginStorage.h 3 | // RTLibrary-ios 4 | // 5 | // Created by Ryan on 14-8-3. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LoginStorage : NSObject 12 | 13 | /** 14 | * 获取登录用户名 15 | * 16 | * @return 17 | */ 18 | + (NSString *)userName; 19 | 20 | /** 21 | * 保存登录用户名 22 | * 23 | * @param userName 24 | */ 25 | + (void)saveUserName:(NSString *)userName; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /RTLibrary-ios/BaseDao.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseDao.m 3 | // ZLYDoc 4 | // 5 | // Created by Ryan on 14-4-15. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import "BaseDao.h" 10 | #import "FMDatabase.h" 11 | 12 | @implementation BaseDao 13 | 14 | -(void)createTable:(NSString *)sql 15 | { 16 | FMDatabase *db = [[RTDatabaseHelper sharedInstance] openDatabase]; 17 | if (![db executeUpdate:sql]) { 18 | DLog(@"Create table failed"); 19 | } 20 | [db close]; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /RTLibrary-ios/LoginHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // LoginHandler.h 3 | // RTLibrary-ios 4 | // 5 | // Created by Ryan on 14-8-3. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import "BaseHandler.h" 10 | #import "UserEntity.h" 11 | 12 | @interface LoginHandler : BaseHandler 13 | 14 | /** 15 | * 用户登录业务逻辑处理 16 | * 17 | * @param user 18 | * @param success 19 | * @param failed 20 | */ 21 | - (void)executeLoginTaskWithUser:(UserEntity *)user success:(SuccessBlock)success failed:(FailedBlock)failed; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /RTLibrary-ios/UserDefaultsUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // UserDefaultsUtils.h 3 | // ZLYDoc 4 | // 键值对操作 5 | // Created by Ryan on 14-4-1. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UserDefaultsUtils : NSObject 12 | 13 | +(void)saveValue:(id) value forKey:(NSString *)key; 14 | 15 | +(id)valueWithKey:(NSString *)key; 16 | 17 | +(BOOL)boolValueWithKey:(NSString *)key; 18 | 19 | +(void)saveBoolValue:(BOOL)value withKey:(NSString *)key; 20 | 21 | +(void)print; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /RTLibrary-ios/LoginViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LoginViewController.m 3 | // RTLibrary-ios 4 | // 5 | // Created by Ryan on 14-8-3. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import "LoginViewController.h" 10 | 11 | @interface LoginViewController () 12 | 13 | @end 14 | 15 | @implementation LoginViewController 16 | 17 | - (void)viewDidLoad 18 | { 19 | [super viewDidLoad]; 20 | 21 | //初始化LoginView,设置LoginViewDelegate处理登录视图的事件 22 | 23 | //在视图代理方法里通过调用LoginHandler处理登录业务逻辑,发起网络请求和结果处理均在LoginHandler中完成 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /RTLibrary-ios/LoginStorage.m: -------------------------------------------------------------------------------- 1 | // 2 | // LoginStorage.m 3 | // RTLibrary-ios 4 | // 5 | // Created by Ryan on 14-8-3. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import "LoginStorage.h" 10 | #import "UserDefaultsUtils.h" 11 | 12 | static NSString * const USER_NAME = @"username"; 13 | 14 | @implementation LoginStorage 15 | 16 | + (void)saveUserName:(NSString *)userName 17 | { 18 | [UserDefaultsUtils saveValue:userName forKey:USER_NAME]; 19 | } 20 | 21 | + (NSString *)userName 22 | { 23 | return [UserDefaultsUtils valueWithKey:USER_NAME]; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Pods/Pods.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/FMDB" "${PODS_ROOT}/Headers/Reachability" "${PODS_ROOT}/Headers/SVProgressHUD" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers" -isystem "${PODS_ROOT}/Headers/AFNetworking" -isystem "${PODS_ROOT}/Headers/FMDB" -isystem "${PODS_ROOT}/Headers/Reachability" -isystem "${PODS_ROOT}/Headers/SVProgressHUD" 4 | OTHER_LDFLAGS = -ObjC -lsqlite3 -framework CoreGraphics -framework MobileCoreServices -framework QuartzCore -framework Security -framework SystemConfiguration 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /RTLibrary-ios/LoginView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LoginView.m 3 | // RTLibrary-ios 4 | // 5 | // Created by Ryan on 14-8-3. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import "LoginView.h" 10 | 11 | @implementation LoginView 12 | 13 | - (id)initWithFrame:(CGRect)frame 14 | { 15 | self = [super initWithFrame:frame]; 16 | if (self) { 17 | // Initialization code 18 | } 19 | return self; 20 | } 21 | 22 | /* 23 | // Only override drawRect: if you perform custom drawing. 24 | // An empty implementation adversely affects performance during animation. 25 | - (void)drawRect:(CGRect)rect 26 | { 27 | // Drawing code 28 | } 29 | */ 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /RTLibrary-ios/RTLibrary-ios-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 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | 18 | #ifdef DEBUG 19 | #define DLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] ) 20 | #else 21 | #define DLog( s, ... ) 22 | #endif 23 | 24 | #import "Constants.h" -------------------------------------------------------------------------------- /RTLibrary-ios/BaseHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseHandler.h 3 | // zlydoc-iphone 4 | // BaseHandler : Every subclass handler should extends 5 | // Created by Ryan on 14-6-25. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * Handler处理完成后调用的Block 13 | */ 14 | typedef void (^CompleteBlock)(); 15 | 16 | /** 17 | * Handler处理成功时调用的Block 18 | */ 19 | typedef void (^SuccessBlock)(id obj); 20 | 21 | /** 22 | * Handler处理失败时调用的Block 23 | */ 24 | typedef void (^FailedBlock)(id obj); 25 | 26 | @interface BaseHandler : NSObject 27 | 28 | /** 29 | * 获取请求URL 30 | * 31 | * @param path 32 | * @return 拼装好的URL 33 | */ 34 | + (NSString *)requestUrlWithPath:(NSString *)path; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /RTLibrary-iosTests/RTLibrary-iosTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.zlycare.${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 | -------------------------------------------------------------------------------- /RTLibrary-iosTests/RTLibrary_iosTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTLibrary_iosTests.m 3 | // RTLibrary-iosTests 4 | // 5 | // Created by Ryan on 14-7-2. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RTLibrary_iosTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation RTLibrary_iosTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /RTLibrary-ios/BaseViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.m 3 | // zlydoc-iphone 4 | // Parent View Controller 5 | // Created by Ryan on 14-5-23. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface BaseViewController () 12 | 13 | @end 14 | 15 | @implementation BaseViewController 16 | 17 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 18 | { 19 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 20 | if (self) { 21 | // Custom initialization 22 | } 23 | return self; 24 | } 25 | 26 | - (void)viewDidLoad 27 | { 28 | [super viewDidLoad]; 29 | // Do any additional setup after loading the view. 30 | } 31 | 32 | - (void)didReceiveMemoryWarning 33 | { 34 | [super didReceiveMemoryWarning]; 35 | // Dispose of any resources that can be recreated. 36 | } 37 | 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /RTLibrary-ios/BaseEntity.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseEntity.h 3 | // ZLYDoc 4 | // 5 | // Created by Ryan on 14-4-3. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define SUCCESS 0 12 | 13 | @interface BaseEntity : NSObject 14 | 15 | @property (nonatomic,copy) NSString *_id;//ID 16 | @property (nonatomic ) int status;//状态 17 | @property (nonatomic ) NSString *msg;//状态信息 18 | @property (nonatomic ) NSString *version;//版本号 19 | @property (nonatomic ) NSString *updateURL;//升级URL 20 | 21 | /** 22 | * 解析HTTP返回异常JSON 23 | * 24 | * @param json 25 | * 26 | * @return 27 | */ 28 | + (BaseEntity *)parseResponseErrorJSON:(id)json; 29 | 30 | /** 31 | * 解析成功或失败状态JSON 32 | * 33 | * @param json 34 | * 35 | * @return 36 | */ 37 | + (BaseEntity *)parseResponseStatusJSON:(id)json; 38 | 39 | /** 40 | * 解析版本号及升级URL JSON 41 | * 42 | * @param json 43 | * 44 | * @return 45 | */ 46 | + (BaseEntity *)parseResponseUpdateJSON:(id)json; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /RTLibrary-ios/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /Pods/AFNetworking/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com/) 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. 20 | -------------------------------------------------------------------------------- /RTLibrary-ios/RTJSONResponseSerializerWithData.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTJSONResponseSerializerWithData.m 3 | // ZLYDoc 4 | // 5 | // Created by Ryan on 14-5-29. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import "RTJSONResponseSerializerWithData.h" 10 | 11 | @implementation RTJSONResponseSerializerWithData 12 | 13 | - (id)responseObjectForResponse:(NSURLResponse *)response 14 | data:(NSData *)data 15 | error:(NSError *__autoreleasing *)error 16 | { 17 | if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { 18 | if (*error != nil) { 19 | NSMutableDictionary *userInfo = [(*error).userInfo mutableCopy]; 20 | userInfo[JSONResponseSerializerWithDataKey] = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 21 | NSError *newError = [NSError errorWithDomain:(*error).domain code:(*error).code userInfo:userInfo]; 22 | (*error) = newError; 23 | } 24 | 25 | return (nil); 26 | } 27 | 28 | return ([super responseObjectForResponse:response data:data error:error]); 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /RTLibrary-ios/Constants.h: -------------------------------------------------------------------------------- 1 | // 2 | // Constants.h 3 | // ZLYDoc 4 | // 系统常量 5 | // Created by Ryan on 14-4-14. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //COLOR 12 | #define COLOR_MAIN @"#0096db" 13 | 14 | //APP INFO 15 | #define APP_NAME @"AppName" 16 | #define VERSION @"v0.1.0" 17 | #define COPYRIGHT @"Copyright @2014 ZLYCARE All Rights Reserved" 18 | 19 | //数据库版本号 20 | #define DB_VERSION @"1" 21 | 22 | //FONT SIZE 23 | #define FONT_SIZE 15.0f 24 | 25 | /// NSError userInfo key that will contain response data 26 | #define JSONResponseSerializerWithDataKey @"JSONResponseSerializerWithDataKey" 27 | 28 | //Notification key 29 | #define k_NOTI_NETWORK_ERROR @"k_NOTI_NETWORK_ERROR" //网络异常 30 | #define k_NOTI_VERSION_UPDATE @"k_NOTI_VERSION_UPDATE" //版本更新通知 31 | 32 | 33 | //UserDefaults 34 | #define k_UD_IMG_TOKEN @"k_UD_IMG_TOKEN" //七牛图片上传token 35 | #define k_UD_IMG_URL @"k_UD_IMG_URL" //七牛图片下载url 36 | 37 | //信息提示 38 | #define TEXT_NETWORK_ERROR @"网络异常,请检查网络连接" 39 | #define TEXT_SERVER_NOT_RESPOND @"服务器或网络异常,请稍后重试" 40 | 41 | @interface Constants : NSObject 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Pods/FMDB/LICENSE.txt: -------------------------------------------------------------------------------- 1 | If you are using fmdb in your project, I'd love to hear about it. Let me 2 | know at gus@flyingmeat.com. 3 | 4 | In short, this is the MIT License. 5 | 6 | Copyright (c) 2008 Flying Meat Inc. 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. -------------------------------------------------------------------------------- /RTLibrary-ios/UserDefaultsUtils.m: -------------------------------------------------------------------------------- 1 | // 2 | // UserDefaultsUtils.m 3 | // ZLYDoc 4 | // 5 | // Created by Ryan on 14-4-1. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import "UserDefaultsUtils.h" 10 | 11 | @implementation UserDefaultsUtils 12 | 13 | +(void)saveValue:(id) value forKey:(NSString *)key{ 14 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; 15 | [userDefaults setObject:value forKey:key]; 16 | [userDefaults synchronize]; 17 | } 18 | 19 | +(id)valueWithKey:(NSString *)key{ 20 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; 21 | return [userDefaults objectForKey:key]; 22 | } 23 | 24 | +(BOOL)boolValueWithKey:(NSString *)key 25 | { 26 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; 27 | return [userDefaults boolForKey:key]; 28 | } 29 | 30 | +(void)saveBoolValue:(BOOL)value withKey:(NSString *)key 31 | { 32 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; 33 | [userDefaults setBool:value forKey:key]; 34 | [userDefaults synchronize]; 35 | } 36 | 37 | +(void)print{ 38 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; 39 | NSDictionary *dic = [userDefaults dictionaryRepresentation]; 40 | DLog(@"%@",dic); 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Pods/SVProgressHUD/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Sam Vermette 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | A different license may apply to other ressources included in this package, 25 | including Joseph Wain's Glyphish Icons. Please consult their 26 | respective headers for the terms of their individual licenses. -------------------------------------------------------------------------------- /RTLibrary-ios/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (2.3.1): 3 | - AFNetworking/NSURLConnection 4 | - AFNetworking/NSURLSession 5 | - AFNetworking/Reachability 6 | - AFNetworking/Security 7 | - AFNetworking/Serialization 8 | - AFNetworking/UIKit 9 | - AFNetworking/NSURLConnection (2.3.1): 10 | - AFNetworking/Reachability 11 | - AFNetworking/Security 12 | - AFNetworking/Serialization 13 | - AFNetworking/NSURLSession (2.3.1): 14 | - AFNetworking/Reachability 15 | - AFNetworking/Security 16 | - AFNetworking/Serialization 17 | - AFNetworking/Reachability (2.3.1) 18 | - AFNetworking/Security (2.3.1) 19 | - AFNetworking/Serialization (2.3.1) 20 | - AFNetworking/UIKit (2.3.1): 21 | - AFNetworking/NSURLConnection 22 | - AFNetworking/NSURLSession 23 | - FMDB (2.3): 24 | - FMDB/standard 25 | - FMDB/common (2.3) 26 | - FMDB/standard (2.3): 27 | - FMDB/common 28 | - Reachability (3.1.1) 29 | - SVProgressHUD (1.0) 30 | 31 | DEPENDENCIES: 32 | - AFNetworking (~> 2.0) 33 | - FMDB (~> 2.3) 34 | - Reachability (~> 3.1.1) 35 | - SVProgressHUD (~> 1.0) 36 | 37 | SPEC CHECKSUMS: 38 | AFNetworking: 6d7b76aa5d04c8c37daad3eef4b7e3f2a7620da3 39 | FMDB: 31ec26773c7f7b7890a6038235a1f2bbd933a7cb 40 | Reachability: 8e9635e3cb4f98e7f825e51147f677ecc694d0e7 41 | SVProgressHUD: 5034c6e22b8c2ca3e09402e48d41ed0340aa1c50 42 | 43 | COCOAPODS: 0.33.1 44 | -------------------------------------------------------------------------------- /Pods/Reachability/LICENCE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2013, Tony Million. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (2.3.1): 3 | - AFNetworking/NSURLConnection 4 | - AFNetworking/NSURLSession 5 | - AFNetworking/Reachability 6 | - AFNetworking/Security 7 | - AFNetworking/Serialization 8 | - AFNetworking/UIKit 9 | - AFNetworking/NSURLConnection (2.3.1): 10 | - AFNetworking/Reachability 11 | - AFNetworking/Security 12 | - AFNetworking/Serialization 13 | - AFNetworking/NSURLSession (2.3.1): 14 | - AFNetworking/Reachability 15 | - AFNetworking/Security 16 | - AFNetworking/Serialization 17 | - AFNetworking/Reachability (2.3.1) 18 | - AFNetworking/Security (2.3.1) 19 | - AFNetworking/Serialization (2.3.1) 20 | - AFNetworking/UIKit (2.3.1): 21 | - AFNetworking/NSURLConnection 22 | - AFNetworking/NSURLSession 23 | - FMDB (2.3): 24 | - FMDB/standard 25 | - FMDB/common (2.3) 26 | - FMDB/standard (2.3): 27 | - FMDB/common 28 | - Reachability (3.1.1) 29 | - SVProgressHUD (1.0) 30 | 31 | DEPENDENCIES: 32 | - AFNetworking (~> 2.0) 33 | - FMDB (~> 2.3) 34 | - Reachability (~> 3.1.1) 35 | - SVProgressHUD (~> 1.0) 36 | 37 | SPEC CHECKSUMS: 38 | AFNetworking: 6d7b76aa5d04c8c37daad3eef4b7e3f2a7620da3 39 | FMDB: 31ec26773c7f7b7890a6038235a1f2bbd933a7cb 40 | Reachability: 8e9635e3cb4f98e7f825e51147f677ecc694d0e7 41 | SVProgressHUD: 5034c6e22b8c2ca3e09402e48d41ed0340aa1c50 42 | 43 | COCOAPODS: 0.33.1 44 | -------------------------------------------------------------------------------- /RTLibrary-ios/RTDatabaseHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBHelper.h 3 | // ZLYDoc 4 | // 数据库管理 5 | // Created by Ryan on 14-4-14. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FMDatabase.h" 11 | #import "BaseEntity.h" 12 | 13 | //________________________________________________________ 14 | /** 15 | * Database operate delegate 16 | */ 17 | @protocol DatabaseDelegate 18 | 19 | @optional 20 | - (BOOL)insert:(BaseEntity *)entity; 21 | - (BOOL)update:(BaseEntity *)entity; 22 | - (BOOL)remove:(BaseEntity *)entity; 23 | - (BOOL)removeClientEntityWithId:(NSString *)id; 24 | - (BaseEntity *)queryById:(NSString *) entityId; 25 | - (NSMutableArray *)queryAll; 26 | - (NSMutableArray *)queryAllOrderByName; 27 | - (NSMutableArray *)queryAllOrderByTime; 28 | - (void)closeDB; 29 | - (BOOL)removeAll; 30 | 31 | @required 32 | - (void)createTable:(NSString *)sql; 33 | 34 | @end 35 | //________________________________________________________ 36 | 37 | @interface RTDatabaseHelper : NSObject 38 | 39 | @property(nonatomic,strong) FMDatabase *database; 40 | 41 | //管理类单例 42 | + (RTDatabaseHelper *)sharedInstance; 43 | 44 | //获取数据库连接对象 45 | - (FMDatabase *)openDatabase; 46 | 47 | //删除所有表的数据 48 | - (void)removeAllData; 49 | 50 | //关闭数据库 51 | - (void)closeDB; 52 | 53 | //删除数据库文件 54 | - (BOOL)deleteDatabase; 55 | 56 | //判断指定表是否存在 57 | - (BOOL)isTableExists:(NSString *)tableName; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /RTLibrary-ios/RTLibrary-ios-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.zlycare.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /RTLibrary-ios/AppUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppUtils.h 3 | // zlydoc+iphone 4 | // 5 | // Created by Ryan on 14+5+23. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppUtils : NSObject 12 | 13 | /********************** System Utils ***********************/ 14 | //弹出UIAlertView 15 | + (void)showAlertMessage:(NSString *)msg; 16 | //关闭键盘 17 | + (void)closeKeyboard; 18 | //获取MD5加密后字符串 19 | + (NSString *)md5FromString:(NSString *)str; 20 | 21 | /******* UITableView & UINavigationController Utils *******/ 22 | //返回View覆盖多余的tableview cell线条 23 | + (UIView *)tableViewsFooterView; 24 | //返回UILabel作为UITableView的header 25 | + (UILabel *)tableViewsHeaderLabelWithMessage:(NSString *)message; 26 | //获取没有文字的导航栏返回按钮 27 | + (UIBarButtonItem *)navigationBackButtonWithNoTitle; 28 | 29 | /********************* SVProgressHUD **********************/ 30 | //弹出操作错误信息提示框 31 | + (void)showErrorMessage:(NSString *)message; 32 | //弹出操作成功信息提示框 33 | + (void)showSuccessMessage:(NSString *)message; 34 | //弹出加载提示框 35 | + (void)showProgressMessage:(NSString *) message; 36 | //取消弹出框 37 | + (void)dismissHUD; 38 | 39 | /********************** NSDate Utils ***********************/ 40 | //根据指定格式将NSDate转换为NSString 41 | + (NSString *)stringFromDate:(NSDate *)date formatter:(NSString *)formatter; 42 | //根据指定格式将NSString转换为NSDate 43 | + (NSDate *)dateFromString:(NSString *)dateString formatter:(NSString *)formatter; 44 | 45 | /********************* Category Utils **********************/ 46 | //根据颜色码取得颜色对象 47 | + (UIColor *)colorWithHexString:(NSString *)stringToConvert; 48 | 49 | /********************* Verification Utils **********************/ 50 | //验证手机号码合法性(正则) 51 | + (BOOL)checkPhoneNumber:(NSString *)phoneNumber; 52 | 53 | @end -------------------------------------------------------------------------------- /RTLibrary-ios/RTHttpClient.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTHttpClient.h 3 | // ZLYDoc 4 | // HTTP网络请求 5 | // Created by Ryan on 14-4-10. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AFNetworking.h" 11 | 12 | //HTTP REQUEST METHOD TYPE 13 | typedef NS_ENUM(NSInteger, RTHttpRequestType) { 14 | RTHttpRequestGet, 15 | RTHttpRequestPost, 16 | RTHttpRequestDelete, 17 | RTHttpRequestPut, 18 | }; 19 | 20 | /** 21 | * 请求开始前预处理Block 22 | */ 23 | typedef void(^PrepareExecuteBlock)(void); 24 | 25 | /**************** RTHttpClient ****************/ 26 | @interface RTHttpClient : NSObject 27 | 28 | + (RTHttpClient *)defaultClient; 29 | 30 | /** 31 | * HTTP请求(GET、POST、DELETE、PUT) 32 | * 33 | * @param path 34 | * @param method RESTFul请求类型 35 | * @param parameters 请求参数 36 | * @param prepare 请求前预处理块 37 | * @param success 请求成功处理块 38 | * @param failure 请求失败处理块 39 | */ 40 | - (void)requestWithPath:(NSString *)url 41 | method:(NSInteger)method 42 | parameters:(id)parameters 43 | prepareExecute:(PrepareExecuteBlock) prepare 44 | success:(void (^)(NSURLSessionDataTask *task, id responseObject))success 45 | failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure; 46 | 47 | /** 48 | * HTTP请求(HEAD) 49 | * 50 | * @param path 51 | * @param parameters 52 | * @param success 53 | * @param failure 54 | */ 55 | - (void)requestWithPathInHEAD:(NSString *)url 56 | parameters:(NSDictionary *)parameters 57 | success:(void (^)(NSURLSessionDataTask *task))success 58 | failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure; 59 | 60 | //判断当前网络状态 61 | - (BOOL)isConnectionAvailable; 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIKit+AFNetworking.h 2 | // 3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #ifndef _UIKIT_AFNETWORKING_ 26 | #define _UIKIT_AFNETWORKING_ 27 | 28 | #import "AFNetworkActivityIndicatorManager.h" 29 | 30 | #import "UIActivityIndicatorView+AFNetworking.h" 31 | #import "UIAlertView+AFNetworking.h" 32 | #import "UIButton+AFNetworking.h" 33 | #import "UIImageView+AFNetworking.h" 34 | #import "UIKit+AFNetworking.h" 35 | #import "UIProgressView+AFNetworking.h" 36 | #import "UIRefreshControl+AFNetworking.h" 37 | #import "UIWebView+AFNetworking.h" 38 | #endif /* _UIKIT_AFNETWORKING_ */ 39 | -------------------------------------------------------------------------------- /Pods/AFNetworking/AFNetworking/AFNetworking.h: -------------------------------------------------------------------------------- 1 | // AFNetworking.h 2 | // 3 | // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | 26 | #ifndef _AFNETWORKING_ 27 | #define _AFNETWORKING_ 28 | 29 | #import "AFURLRequestSerialization.h" 30 | #import "AFURLResponseSerialization.h" 31 | #import "AFSecurityPolicy.h" 32 | #import "AFNetworkReachabilityManager.h" 33 | 34 | #import "AFURLConnectionOperation.h" 35 | #import "AFHTTPRequestOperation.h" 36 | #import "AFHTTPRequestOperationManager.h" 37 | 38 | #if ( ( defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) || \ 39 | ( defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 ) ) 40 | #import "AFURLSessionManager.h" 41 | #import "AFHTTPSessionManager.h" 42 | #endif 43 | 44 | #endif /* _AFNETWORKING_ */ 45 | -------------------------------------------------------------------------------- /RTLibrary-ios/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // RTLibrary-ios 4 | // 5 | // Created by Ryan on 14-7-2. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 16 | // Override point for customization after application launch. 17 | self.window.backgroundColor = [UIColor whiteColor]; 18 | [self.window makeKeyAndVisible]; 19 | return YES; 20 | } 21 | 22 | - (void)applicationWillResignActive:(UIApplication *)application 23 | { 24 | // 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. 25 | // 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. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application 29 | { 30 | // 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. 31 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 32 | } 33 | 34 | - (void)applicationWillEnterForeground:(UIApplication *)application 35 | { 36 | // 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. 37 | } 38 | 39 | - (void)applicationDidBecomeActive:(UIApplication *)application 40 | { 41 | // 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. 42 | } 43 | 44 | - (void)applicationWillTerminate:(UIApplication *)application 45 | { 46 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pods/Reachability/README.md: -------------------------------------------------------------------------------- 1 | # Reachability 2 | 3 | This is a drop-in replacement for Apple's `Reachability` class. It is ARC-compatible, and it uses the new GCD methods to notify of network interface changes. 4 | 5 | In addition to the standard `NSNotification`, it supports the use of blocks for when the network becomes reachable and unreachable. 6 | 7 | Finally, you can specify whether a WWAN connection is considered "reachable". 8 | 9 | ## Requirements 10 | 11 | Once you have added the `.h/m` files to your project, simply: 12 | 13 | * Go to the `Project->TARGETS->Build Phases->Link Binary With Libraries`. 14 | * Press the plus in the lower left of the list. 15 | * Add `SystemConfiguration.framework`. 16 | 17 | Boom, you're done. 18 | 19 | ## Examples 20 | 21 | ### Block Example 22 | 23 | This sample uses blocks to notify when the interface state has changed. The blocks will be called on a **BACKGROUND THREAD**, so you need to dispatch UI updates onto the main thread. 24 | 25 | // Allocate a reachability object 26 | Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"]; 27 | 28 | // Set the blocks 29 | reach.reachableBlock = ^(Reachability*reach) 30 | { 31 | NSLog(@"REACHABLE!"); 32 | }; 33 | 34 | reach.unreachableBlock = ^(Reachability*reach) 35 | { 36 | NSLog(@"UNREACHABLE!"); 37 | }; 38 | 39 | // Start the notifier, which will cause the reachability object to retain itself! 40 | [reach startNotifier]; 41 | 42 | ### `NSNotification` Example 43 | 44 | This sample will use `NSNotification`s to notify when the interface has changed. They will be delivered on the **MAIN THREAD**, so you *can* do UI updates from within the function. 45 | 46 | In addition, it asks the `Reachability` object to consider the WWAN (3G/EDGE/CDMA) as a non-reachable connection (you might use this if you are writing a video streaming app, for example, to save the user's data plan). 47 | 48 | // Allocate a reachability object 49 | Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"]; 50 | 51 | // Tell the reachability that we DON'T want to be reachable on 3G/EDGE/CDMA 52 | reach.reachableOnWWAN = NO; 53 | 54 | // Here we set up a NSNotification observer. The Reachability that caused the notification 55 | // is passed in the object parameter 56 | [[NSNotificationCenter defaultCenter] addObserver:self 57 | selector:@selector(reachabilityChanged:) 58 | name:kReachabilityChangedNotification 59 | object:nil]; 60 | 61 | [reach startNotifier] 62 | 63 | ## Tell the world 64 | 65 | Head over to [Projects using Reachability](https://github.com/tonymillion/Reachability/wiki/Projects-using-Reachability) and add your project for "Maximum Wins!". 66 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIRefreshControl+AFNetworking.m 2 | // 3 | // Copyright (c) 2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | @class AFURLConnectionOperation; 32 | 33 | /** 34 | This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically begining and ending refreshing depending on the loading state of a request operation or session task. 35 | */ 36 | @interface UIRefreshControl (AFNetworking) 37 | 38 | ///----------------------------------- 39 | /// @name Refreshing for Session Tasks 40 | ///----------------------------------- 41 | 42 | /** 43 | Binds the refreshing state to the state of the specified task. 44 | 45 | @param task The task. If `nil`, automatic updating from any previously specified operation will be diabled. 46 | */ 47 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 48 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task; 49 | #endif 50 | 51 | ///---------------------------------------- 52 | /// @name Refreshing for Request Operations 53 | ///---------------------------------------- 54 | 55 | /** 56 | Binds the refreshing state to the execution state of the specified operation. 57 | 58 | @param operation The operation. If `nil`, automatic updating from any previously specified operation will be disabled. 59 | */ 60 | - (void)setRefreshingWithStateOfOperation:(AFURLConnectionOperation *)operation; 61 | 62 | @end 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIActivityIndicatorView+AFNetworking.h 2 | // 3 | // Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | @class AFURLConnectionOperation; 32 | 33 | /** 34 | This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a request operation or session task. 35 | */ 36 | @interface UIActivityIndicatorView (AFNetworking) 37 | 38 | ///---------------------------------- 39 | /// @name Animating for Session Tasks 40 | ///---------------------------------- 41 | 42 | /** 43 | Binds the animating state to the state of the specified task. 44 | 45 | @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. 46 | */ 47 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 48 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task; 49 | #endif 50 | 51 | ///--------------------------------------- 52 | /// @name Animating for Request Operations 53 | ///--------------------------------------- 54 | 55 | /** 56 | Binds the animating state to the execution state of the specified operation. 57 | 58 | @param operation The operation. If `nil`, automatic updating from any previously specified operation will be disabled. 59 | */ 60 | - (void)setAnimatingWithStateOfOperation:(AFURLConnectionOperation *)operation; 61 | 62 | @end 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /RTLibrary-ios/BaseEntity.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseEntity.m 3 | // ZLYDoc 4 | // 5 | // Created by Ryan on 14-4-3. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import "BaseEntity.h" 10 | 11 | static NSString * const MSG = @"msg"; 12 | static NSString * const STATUS = @"status"; 13 | static NSString * const RES = @"res"; 14 | 15 | @implementation BaseEntity 16 | 17 | +(BaseEntity* )parseResponseErrorJSON:(id)json 18 | { 19 | NSString *responseJSON = [NSString stringWithFormat:@"%@",json]; 20 | DLog(@"%@",responseJSON); 21 | NSData *jsonData = [responseJSON dataUsingEncoding:NSUTF8StringEncoding]; 22 | NSDictionary *dic_json = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil]; 23 | if ([NSJSONSerialization isValidJSONObject:dic_json]) { 24 | BaseEntity *baseEntity = [[BaseEntity alloc] init]; 25 | baseEntity.status = [((NSNumber *)[dic_json objectForKey:STATUS]) intValue]; 26 | baseEntity.msg = [dic_json objectForKey:MSG]; 27 | return baseEntity; 28 | } 29 | return nil; 30 | } 31 | 32 | + (BaseEntity *)parseResponseStatusJSON:(id)json 33 | { 34 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:json options:NSJSONWritingPrettyPrinted error:nil]; 35 | //格式化打印输出至控制台 36 | NSString *responseJSON = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; 37 | DLog(@"%@",responseJSON); 38 | NSDictionary *dic_json = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil]; 39 | if ([NSJSONSerialization isValidJSONObject:dic_json]) { 40 | NSNumber *status = (NSNumber *)[dic_json objectForKey:STATUS]; 41 | BaseEntity *baseEntity = [[BaseEntity alloc] init]; 42 | baseEntity.status = [status intValue]; 43 | baseEntity.msg = [dic_json objectForKey:MSG]; 44 | return baseEntity; 45 | } 46 | return nil; 47 | } 48 | 49 | +(BaseEntity *)parseResponseUpdateJSON:(id)json 50 | { 51 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:json options:NSJSONWritingPrettyPrinted error:nil]; 52 | //格式化打印输出至控制台 53 | NSString *responseJSON = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; 54 | DLog(@"%@",responseJSON); 55 | NSDictionary *dic_json = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil]; 56 | if ([NSJSONSerialization isValidJSONObject:dic_json]) { 57 | NSNumber *status = (NSNumber *)[dic_json objectForKey:STATUS]; 58 | BaseEntity *baseEntity = [[BaseEntity alloc] init]; 59 | baseEntity.status = [status intValue]; 60 | id res = [dic_json objectForKey:RES]; 61 | baseEntity.version = [res objectForKey:@"v"]; 62 | baseEntity.updateURL = [res objectForKey:@"url"]; 63 | return baseEntity; 64 | } 65 | return nil; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /RTLibrary-ios/RTDatabaseHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // DBHelper.m 3 | // ZLYDoc 4 | // 5 | // Created by Ryan on 14-4-14. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import "RTDatabaseHelper.h" 10 | 11 | @implementation RTDatabaseHelper 12 | 13 | - (id)init 14 | { 15 | if (self = [super init]) { 16 | NSString* docsdir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; 17 | NSString *dbpath = [docsdir stringByAppendingPathComponent:@"zlycare.sqlite"]; 18 | _database = [FMDatabase databaseWithPath:dbpath]; 19 | } 20 | return self; 21 | } 22 | 23 | + (RTDatabaseHelper *)sharedInstance 24 | { 25 | static RTDatabaseHelper *instance = nil; 26 | static dispatch_once_t predicate; 27 | dispatch_once(&predicate, ^{ 28 | instance = [[self alloc] init]; 29 | }); 30 | return instance; 31 | } 32 | 33 | - (FMDatabase *)openDatabase 34 | { 35 | if ([_database open]) { 36 | return _database; 37 | } 38 | return nil; 39 | } 40 | 41 | - (void)removeAllData 42 | { 43 | NSDictionary *dic_sql = [self sqlForCreateTable]; 44 | for (NSString *tableName in [dic_sql allKeys]) { 45 | NSString *sql = [NSString stringWithFormat:@"delete from %@ where 1 = 1",tableName]; 46 | BOOL is_delete = [[[RTDatabaseHelper sharedInstance] openDatabase] executeUpdate:sql]; 47 | DLog(@"%@",is_delete ? @"Delete all data success...":@"Delete all data failed..."); 48 | } 49 | } 50 | 51 | - (BOOL)isTableExists:(NSString *)tableName 52 | { 53 | NSString *existsSql = [NSString stringWithFormat:@"select count(name) as countNum from sqlite_master where type = 'table' and name = '%@'", tableName]; 54 | 55 | FMResultSet *rs = [[self openDatabase] executeQuery:existsSql]; 56 | 57 | if ([rs next]) { 58 | NSInteger count = [rs intForColumn:@"countNum"]; 59 | if (count == 1) { 60 | DLog(@"%@ is existed.",tableName); 61 | return YES; 62 | } 63 | DLog(@"%@ is not exist.",tableName); 64 | } 65 | [rs close]; 66 | 67 | return NO; 68 | } 69 | 70 | - (void)closeDB 71 | { 72 | dispatch_async(dispatch_get_main_queue(), ^{ 73 | if([_database close]) { 74 | _database = nil; 75 | } 76 | }); 77 | } 78 | 79 | - (BOOL)deleteDatabase 80 | { 81 | NSString* docsdir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; 82 | NSString *dbpath = [docsdir stringByAppendingPathComponent:@"zlycare.sqlite"]; 83 | NSFileManager *fileManager = [NSFileManager defaultManager]; 84 | return [fileManager removeItemAtPath:dbpath error:nil]; 85 | } 86 | 87 | - (NSDictionary *)sqlForCreateTable 88 | { 89 | NSString *sqlFilePath = [[NSBundle mainBundle] pathForResource:@"sql" ofType:@"plist"]; 90 | NSDictionary *dic_sql = [NSDictionary dictionaryWithContentsOfFile:sqlFilePath]; 91 | return dic_sql; 92 | } 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /RTLibrary-ios/BaseTableViewProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // UITableView通用代理协议 3 | // zlydoc-iphone 4 | // UITableView Protocol 5 | // Created by Ryan on 14-5-24. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //_________________________________________________________________________________________________________ 12 | //UITableViewCell操作代理协议 13 | @protocol TableViewCellDelegate 14 | 15 | @optional 16 | /** 17 | * 点击或选中cell时的代理方法 18 | * 19 | * @param indexPath 20 | */ 21 | - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath; 22 | 23 | /** 24 | * 删除cell时的代理方法 25 | * 26 | * @param indexPath 27 | */ 28 | - (void)deleteRowAtIndexPath:(NSIndexPath *)indexPath; 29 | 30 | /** 31 | * 根据返回值判断该cell是否可以被操作(移动、删除、插入等) 32 | * 33 | * @return YES:Can NO:Cant 34 | */ 35 | - (BOOL)isCellEditable; 36 | 37 | /** 38 | * 返回Cell高度的代理方法 39 | * 40 | * @param indexPath 41 | * 42 | * @return 43 | */ 44 | - (CGFloat)cellHeightAtIndexPath:(NSIndexPath *)indexPath; 45 | 46 | @end 47 | //_________________________________________________________________________________________________________ 48 | /** 49 | * 配置UITableViewCell展现方式的block 50 | * 51 | * @param cell UITableViewCell及其子类 52 | * @param entity Cell对应的实体 53 | * @param indexPath 54 | */ 55 | typedef void (^TableViewCellConfigurate)(id cell, id entity, NSIndexPath *indexPath); 56 | 57 | /** 58 | * 配置不同section中的cell的行数(rows) 59 | * 60 | * @param section section下标 61 | * 62 | * @return TableView中section的数量 63 | */ 64 | typedef NSInteger (^TableViewNumberOfRowsInSectionConfigurate) (NSInteger section); 65 | 66 | 67 | /**************** TableViewProtocol ****************/ 68 | @interface BaseTableViewProtocol : NSObject 69 | 70 | // UITableViewDelegate和UITableViewDatasource代理 71 | @property (nonatomic,strong) id delegate; 72 | 73 | /** 74 | * 协议构造器1:有多个section,每个section中cell行数不定时使用 75 | * 76 | * @param aItems 77 | * @param aCellIdentifier 78 | * @param aSectionNumber section的数量 79 | * @param aNunberOfRowsInSectionConfigureBlock 配置每个section中cell的行数 80 | * @param aCellConfigureBlock 配置每个cell的展现方式 81 | * 82 | * @return Protocal Object 83 | */ 84 | -(id)initWithItems:(NSArray *)aItems 85 | cellIdentifier:(NSString *)aCellIdentifier 86 | numberOfSections:(NSInteger)aSectionNumber 87 | numberOfRowsInSectionConfigureBlock:(TableViewNumberOfRowsInSectionConfigurate)aNunberOfRowsInSectionConfigureBlock 88 | cellConfigureBlock:(TableViewCellConfigurate)aCellConfigureBlock; 89 | 90 | /** 91 | * 协议构造器2:默认只有一个section时使用 92 | * 93 | * @param aItems 94 | * @param aCellIdentifier 95 | * @param aCellConfigureBlock 96 | * 97 | * @return Protocal Object 98 | */ 99 | -(id)initWithItems:(NSArray *)aItems 100 | cellIdentifier:(NSString *)aCellIdentifier 101 | cellConfigureBlock:(TableViewCellConfigurate)aCellConfigureBlock; 102 | 103 | @end 104 | -------------------------------------------------------------------------------- /Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVProgressHUD.h 3 | // 4 | // Created by Sam Vermette on 27.03.11. 5 | // Copyright 2011 Sam Vermette. All rights reserved. 6 | // 7 | // https://github.com/samvermette/SVProgressHUD 8 | // 9 | 10 | #import 11 | #import 12 | 13 | extern NSString * const SVProgressHUDDidReceiveTouchEventNotification; 14 | extern NSString * const SVProgressHUDWillDisappearNotification; 15 | extern NSString * const SVProgressHUDDidDisappearNotification; 16 | extern NSString * const SVProgressHUDWillAppearNotification; 17 | extern NSString * const SVProgressHUDDidAppearNotification; 18 | 19 | extern NSString * const SVProgressHUDStatusUserInfoKey; 20 | 21 | enum { 22 | SVProgressHUDMaskTypeNone = 1, // allow user interactions while HUD is displayed 23 | SVProgressHUDMaskTypeClear, // don't allow 24 | SVProgressHUDMaskTypeBlack, // don't allow and dim the UI in the back of the HUD 25 | SVProgressHUDMaskTypeGradient // don't allow and dim the UI with a a-la-alert-view bg gradient 26 | }; 27 | 28 | typedef NSUInteger SVProgressHUDMaskType; 29 | 30 | @interface SVProgressHUD : UIView 31 | 32 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 50000 33 | @property (readwrite, nonatomic, retain) UIColor *hudBackgroundColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 34 | @property (readwrite, nonatomic, retain) UIColor *hudForegroundColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 35 | @property (readwrite, nonatomic, retain) UIColor *hudStatusShadowColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 36 | @property (readwrite, nonatomic, retain) UIColor *hudRingBackgroundColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 37 | @property (readwrite, nonatomic, retain) UIColor *hudRingForegroundColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 38 | @property (readwrite, nonatomic, retain) UIFont *hudFont NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 39 | @property (readwrite, nonatomic, retain) UIImage *hudSuccessImage NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 40 | @property (readwrite, nonatomic, retain) UIImage *hudErrorImage NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 41 | #endif 42 | 43 | + (void)setOffsetFromCenter:(UIOffset)offset; 44 | + (void)resetOffsetFromCenter; 45 | 46 | + (void)show; 47 | + (void)showWithMaskType:(SVProgressHUDMaskType)maskType; 48 | + (void)showWithStatus:(NSString*)status; 49 | + (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; 50 | 51 | + (void)showProgress:(float)progress; 52 | + (void)showProgress:(float)progress status:(NSString*)status; 53 | + (void)showProgress:(float)progress status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; 54 | 55 | + (void)setStatus:(NSString*)string; // change the HUD loading status while it's showing 56 | 57 | // stops the activity indicator, shows a glyph + status, and dismisses HUD 1s later 58 | + (void)showSuccessWithStatus:(NSString*)string; 59 | + (void)showErrorWithStatus:(NSString *)string; 60 | + (void)showImage:(UIImage*)image status:(NSString*)status; // use 28x28 white pngs 61 | 62 | + (void)popActivity; 63 | + (void)dismiss; 64 | 65 | + (BOOL)isVisible; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /Pods/Pods-environment.h: -------------------------------------------------------------------------------- 1 | 2 | // To check if a library is compiled with CocoaPods you 3 | // can use the `COCOAPODS` macro definition which is 4 | // defined in the xcconfigs so it is available in 5 | // headers also when they are imported in the client 6 | // project. 7 | 8 | 9 | // AFNetworking 10 | #define COCOAPODS_POD_AVAILABLE_AFNetworking 11 | #define COCOAPODS_VERSION_MAJOR_AFNetworking 2 12 | #define COCOAPODS_VERSION_MINOR_AFNetworking 3 13 | #define COCOAPODS_VERSION_PATCH_AFNetworking 1 14 | 15 | // AFNetworking/NSURLConnection 16 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_NSURLConnection 17 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_NSURLConnection 2 18 | #define COCOAPODS_VERSION_MINOR_AFNetworking_NSURLConnection 3 19 | #define COCOAPODS_VERSION_PATCH_AFNetworking_NSURLConnection 1 20 | 21 | // AFNetworking/NSURLSession 22 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_NSURLSession 23 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_NSURLSession 2 24 | #define COCOAPODS_VERSION_MINOR_AFNetworking_NSURLSession 3 25 | #define COCOAPODS_VERSION_PATCH_AFNetworking_NSURLSession 1 26 | 27 | // AFNetworking/Reachability 28 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_Reachability 29 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_Reachability 2 30 | #define COCOAPODS_VERSION_MINOR_AFNetworking_Reachability 3 31 | #define COCOAPODS_VERSION_PATCH_AFNetworking_Reachability 1 32 | 33 | // AFNetworking/Security 34 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_Security 35 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_Security 2 36 | #define COCOAPODS_VERSION_MINOR_AFNetworking_Security 3 37 | #define COCOAPODS_VERSION_PATCH_AFNetworking_Security 1 38 | 39 | // AFNetworking/Serialization 40 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_Serialization 41 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_Serialization 2 42 | #define COCOAPODS_VERSION_MINOR_AFNetworking_Serialization 3 43 | #define COCOAPODS_VERSION_PATCH_AFNetworking_Serialization 1 44 | 45 | // AFNetworking/UIKit 46 | #define COCOAPODS_POD_AVAILABLE_AFNetworking_UIKit 47 | #define COCOAPODS_VERSION_MAJOR_AFNetworking_UIKit 2 48 | #define COCOAPODS_VERSION_MINOR_AFNetworking_UIKit 3 49 | #define COCOAPODS_VERSION_PATCH_AFNetworking_UIKit 1 50 | 51 | // FMDB 52 | #define COCOAPODS_POD_AVAILABLE_FMDB 53 | #define COCOAPODS_VERSION_MAJOR_FMDB 2 54 | #define COCOAPODS_VERSION_MINOR_FMDB 3 55 | #define COCOAPODS_VERSION_PATCH_FMDB 0 56 | 57 | // FMDB/common 58 | #define COCOAPODS_POD_AVAILABLE_FMDB_common 59 | #define COCOAPODS_VERSION_MAJOR_FMDB_common 2 60 | #define COCOAPODS_VERSION_MINOR_FMDB_common 3 61 | #define COCOAPODS_VERSION_PATCH_FMDB_common 0 62 | 63 | // FMDB/standard 64 | #define COCOAPODS_POD_AVAILABLE_FMDB_standard 65 | #define COCOAPODS_VERSION_MAJOR_FMDB_standard 2 66 | #define COCOAPODS_VERSION_MINOR_FMDB_standard 3 67 | #define COCOAPODS_VERSION_PATCH_FMDB_standard 0 68 | 69 | // Reachability 70 | #define COCOAPODS_POD_AVAILABLE_Reachability 71 | #define COCOAPODS_VERSION_MAJOR_Reachability 3 72 | #define COCOAPODS_VERSION_MINOR_Reachability 1 73 | #define COCOAPODS_VERSION_PATCH_Reachability 1 74 | 75 | // SVProgressHUD 76 | #define COCOAPODS_POD_AVAILABLE_SVProgressHUD 77 | #define COCOAPODS_VERSION_MAJOR_SVProgressHUD 1 78 | #define COCOAPODS_VERSION_MINOR_SVProgressHUD 0 79 | #define COCOAPODS_VERSION_PATCH_SVProgressHUD 0 80 | 81 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIProgressView+AFNetworking.h 2 | // 3 | // Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | @class AFURLConnectionOperation; 32 | 33 | /** 34 | This category adds methods to the UIKit framework's `UIProgressView` class. The methods in this category provide support for binding the progress to the upload and download progress of a session task or request operation. 35 | */ 36 | @interface UIProgressView (AFNetworking) 37 | 38 | ///------------------------------------ 39 | /// @name Setting Session Task Progress 40 | ///------------------------------------ 41 | 42 | /** 43 | Binds the progress to the upload progress of the specified session task. 44 | 45 | @param task The session task. 46 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. 47 | */ 48 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 49 | - (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task 50 | animated:(BOOL)animated; 51 | #endif 52 | 53 | /** 54 | Binds the progress to the download progress of the specified session task. 55 | 56 | @param task The session task. 57 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. 58 | */ 59 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 60 | - (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task 61 | animated:(BOOL)animated; 62 | #endif 63 | 64 | ///------------------------------------ 65 | /// @name Setting Session Task Progress 66 | ///------------------------------------ 67 | 68 | /** 69 | Binds the progress to the upload progress of the specified request operation. 70 | 71 | @param operation The request operation. 72 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. 73 | */ 74 | - (void)setProgressWithUploadProgressOfOperation:(AFURLConnectionOperation *)operation 75 | animated:(BOOL)animated; 76 | 77 | /** 78 | Binds the progress to the download progress of the specified request operation. 79 | 80 | @param operation The request operation. 81 | @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. 82 | */ 83 | - (void)setProgressWithDownloadProgressOfOperation:(AFURLConnectionOperation *)operation 84 | animated:(BOOL)animated; 85 | 86 | @end 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /Pods/Pods-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 5 | > "$RESOURCES_TO_COPY" 6 | 7 | install_resource() 8 | { 9 | case $1 in 10 | *.storyboard) 11 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 12 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 13 | ;; 14 | *.xib) 15 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 16 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 17 | ;; 18 | *.framework) 19 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 21 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 22 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 23 | ;; 24 | *.xcdatamodel) 25 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 26 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 27 | ;; 28 | *.xcdatamodeld) 29 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 30 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 31 | ;; 32 | *.xcassets) 33 | ;; 34 | /*) 35 | echo "$1" 36 | echo "$1" >> "$RESOURCES_TO_COPY" 37 | ;; 38 | *) 39 | echo "${PODS_ROOT}/$1" 40 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 41 | ;; 42 | esac 43 | } 44 | install_resource "SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle" 45 | 46 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 47 | if [[ "${ACTION}" == "install" ]]; then 48 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 49 | fi 50 | rm -f "$RESOURCES_TO_COPY" 51 | 52 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ `xcrun --find actool` ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ] 53 | then 54 | case "${TARGETED_DEVICE_FAMILY}" in 55 | 1,2) 56 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 57 | ;; 58 | 1) 59 | TARGET_DEVICE_ARGS="--target-device iphone" 60 | ;; 61 | 2) 62 | TARGET_DEVICE_ARGS="--target-device ipad" 63 | ;; 64 | *) 65 | TARGET_DEVICE_ARGS="--target-device mac" 66 | ;; 67 | esac 68 | find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 69 | fi 70 | -------------------------------------------------------------------------------- /RTLibrary-ios/BaseTableViewProtocol.m: -------------------------------------------------------------------------------- 1 | // 2 | // CellsProtocal.m 3 | // zlydoc-iphone 4 | // 5 | // Created by Ryan on 14-5-24. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import "BaseTableViewProtocol.h" 10 | 11 | @interface BaseTableViewProtocol() 12 | 13 | @property (nonatomic,copy ) NSString *cellIdentifier; 14 | @property (nonatomic,strong) NSArray *items; 15 | //Number of sections in table view 16 | @property (nonatomic ) NSInteger sectionNumber; 17 | //Block for cell configuration 18 | @property (nonatomic,copy ) TableViewCellConfigurate cellConfigureBlock; 19 | //Block for number of rows configuration 20 | @property (nonatomic,copy ) TableViewNumberOfRowsInSectionConfigurate numberOfRowsConfigure; 21 | 22 | @end 23 | 24 | @implementation BaseTableViewProtocol 25 | 26 | -(id)initWithItems:(NSArray *)aItems 27 | cellIdentifier:(NSString *)aCellIdentifier 28 | numberOfSections:(NSInteger)aSectionNumber 29 | numberOfRowsInSectionConfigureBlock:(TableViewNumberOfRowsInSectionConfigurate)aNunberOfRowsInSectionConfigureBlock 30 | cellConfigureBlock:(TableViewCellConfigurate)aCellConfigureBlock; 31 | { 32 | self = [super init]; 33 | if (self) { 34 | self.items = aItems; 35 | self.cellIdentifier = aCellIdentifier; 36 | self.sectionNumber = aSectionNumber; 37 | self.numberOfRowsConfigure = [aNunberOfRowsInSectionConfigureBlock copy]; 38 | self.cellConfigureBlock = [aCellConfigureBlock copy]; 39 | } 40 | return self; 41 | } 42 | 43 | -(id)initWithItems:(NSArray *)aItems 44 | cellIdentifier:(NSString *)aCellIdentifier 45 | cellConfigureBlock:(TableViewCellConfigurate)aCellConfigureBlock 46 | { 47 | return [self initWithItems:aItems 48 | cellIdentifier:aCellIdentifier 49 | numberOfSections:1 50 | numberOfRowsInSectionConfigureBlock:nil 51 | cellConfigureBlock:aCellConfigureBlock]; 52 | } 53 | 54 | #pragma mark - UITableView Delegate 55 | -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 56 | { 57 | return self.sectionNumber; 58 | } 59 | 60 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 61 | { 62 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 63 | if (self.delegate && [self.delegate respondsToSelector:@selector(selectRowAtIndexPath:)]) { 64 | [self.delegate selectRowAtIndexPath:indexPath]; 65 | } 66 | } 67 | 68 | #pragma mark - UITableView Datasource 69 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 70 | { 71 | if (self.numberOfRowsConfigure) { 72 | return self.numberOfRowsConfigure(section); 73 | } 74 | return self.items.count; 75 | } 76 | 77 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 78 | { 79 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:self.cellIdentifier]; 80 | id item = self.items[(NSUInteger)indexPath.row]; 81 | self.cellConfigureBlock(cell,item,indexPath); 82 | return cell; 83 | } 84 | 85 | -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 86 | { 87 | if (editingStyle == UITableViewCellEditingStyleDelete) { 88 | if (self.delegate) { 89 | [self.delegate deleteRowAtIndexPath:indexPath]; 90 | } 91 | } 92 | } 93 | 94 | -(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath 95 | { 96 | if ([self.delegate respondsToSelector:@selector(isCellEditable)]) { 97 | return [self.delegate isCellEditable]; 98 | } 99 | return NO; 100 | } 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /Pods/SVProgressHUD/README.md: -------------------------------------------------------------------------------- 1 | # SVProgressHUD 2 | 3 | SVProgressHUD is a clean and easy-to-use HUD meant to display the progress of an ongoing task. 4 | 5 | ![SVProgressHUD](http://f.cl.ly/items/3r2x0b1E1O2F0V422a3R/screenshots2.png) 6 | 7 | ## Installation 8 | 9 | ### From CocoaPods 10 | 11 | Add `pod 'SVProgressHUD'` to your Podfile or `pod 'SVProgressHUD', :head` if you're feeling adventurous. 12 | 13 | ### Manually 14 | 15 | _**Important note if your project doesn't use ARC**: you must add the `-fobjc-arc` compiler flag to `SVProgressHUD.m` in Target Settings > Build Phases > Compile Sources._ 16 | 17 | * Drag the `SVProgressHUD/SVProgressHUD` folder into your project. 18 | * Add the **QuartzCore** framework to your project. 19 | 20 | ## Usage 21 | 22 | (see sample Xcode project in `/Demo`) 23 | 24 | SVProgressHUD is created as a singleton (i.e. it doesn't need to be explicitly allocated and instantiated; you directly call `[SVProgressHUD method]`). 25 | 26 | ### Showing the HUD 27 | 28 | You can show the status of indeterminate tasks using: 29 | 30 | ```objective-c 31 | + (void)show; 32 | + (void)showWithMaskType:(SVProgressHUDMaskType)maskType; 33 | + (void)showWithStatus:(NSString*)string; 34 | + (void)showWithStatus:(NSString*)string maskType:(SVProgressHUDMaskType)maskType; 35 | ``` 36 | 37 | If you'd like the HUD to reflect the progress of a task, use: 38 | 39 | ```objective-c 40 | + (void)showProgress:(CGFloat)progress; 41 | + (void)showProgress:(CGFloat)progress status:(NSString*)status; 42 | + (void)showProgress:(CGFloat)progress status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; 43 | ``` 44 | 45 | ##### SVProgressHUDMaskType 46 | 47 | You can optionally disable user interactions while the HUD is shown using the `maskType` property: 48 | 49 | ```objective-c 50 | enum { 51 | SVProgressHUDMaskTypeNone = 1, // allow user interactions, don't dim background UI (default) 52 | SVProgressHUDMaskTypeClear, // disable user interactions, don't dim background UI 53 | SVProgressHUDMaskTypeBlack, // disable user interactions, dim background UI with 50% translucent black 54 | SVProgressHUDMaskTypeGradient // disable user interactions, dim background UI with translucent radial gradient (a-la-alertView) 55 | }; 56 | ``` 57 | 58 | ### Dismissing the HUD 59 | 60 | It can be dismissed right away using: 61 | 62 | ```objective-c 63 | + (void)dismiss; 64 | ``` 65 | 66 | If you'd like to stack HUDs, you can balance out every show call using: 67 | 68 | ```objective-c 69 | + (void)popActivity; 70 | ``` 71 | 72 | The HUD will get dismissed once the `popActivity` calls will match the number of show calls. 73 | 74 | Or show a confirmation glyph before before getting dismissed 1 second later using: 75 | 76 | ```objective-c 77 | + (void)showSuccessWithStatus:(NSString*)string; 78 | + (void)showErrorWithStatus:(NSString *)string; 79 | + (void)showImage:(UIImage*)image status:(NSString*)string; // use 28x28 white pngs 80 | ``` 81 | 82 | ### Observing HUD Notifications 83 | 84 | `SVProgressHUD` posts four notifications via `NSNotificationCenter` in response to being shown/dismissed: 85 | * `SVProgressHUDWillAppearNotification` when the show animation starts 86 | * `SVProgressHUDDidAppearNotification` when the show animation completes 87 | * `SVProgressHUDWillDisappearNotification` when the dismiss animation starts 88 | * `SVProgressHUDDidDisappearNotification` when the dismiss animation completes 89 | 90 | Each notification passes a `userInfo` dictionary holding the HUD's status string (if any), retrievable via `SVProgressHUDStatusUserInfoKey` 91 | 92 | ## Credits 93 | 94 | SVProgressHUD is brought to you by [Sam Vermette](http://samvermette.com) and [contributors to the project](https://github.com/samvermette/SVProgressHUD/contributors). The success and error icons are from [Glyphish](http://glyphish.com/). If you have feature suggestions or bug reports, feel free to help out by sending pull requests or by [creating new issues](https://github.com/samvermette/SVProgressHUD/issues/new). If you're using SVProgressHUD in your project, attribution would be nice. 95 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h: -------------------------------------------------------------------------------- 1 | // AFNetworkActivityIndicatorManager.h 2 | // 3 | // Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | /** 32 | `AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a network request operation has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero. 33 | 34 | You should enable the shared instance of `AFNetworkActivityIndicatorManager` when your application finishes launching. In `AppDelegate application:didFinishLaunchingWithOptions:` you can do so with the following code: 35 | 36 | [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES]; 37 | 38 | By setting `isNetworkActivityIndicatorVisible` to `YES` for `sharedManager`, the network activity indicator will show and hide automatically as requests start and finish. You should not ever need to call `incrementActivityCount` or `decrementActivityCount` yourself. 39 | 40 | See the Apple Human Interface Guidelines section about the Network Activity Indicator for more information: 41 | http://developer.apple.com/library/iOS/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW44 42 | */ 43 | @interface AFNetworkActivityIndicatorManager : NSObject 44 | 45 | /** 46 | A Boolean value indicating whether the manager is enabled. 47 | 48 | If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO. 49 | */ 50 | @property (nonatomic, assign, getter = isEnabled) BOOL enabled; 51 | 52 | /** 53 | A Boolean value indicating whether the network activity indicator is currently displayed in the status bar. 54 | */ 55 | @property (readonly, nonatomic, assign) BOOL isNetworkActivityIndicatorVisible; 56 | 57 | /** 58 | Returns the shared network activity indicator manager object for the system. 59 | 60 | @return The systemwide network activity indicator manager. 61 | */ 62 | + (instancetype)sharedManager; 63 | 64 | /** 65 | Increments the number of active network requests. If this number was zero before incrementing, this will start animating the status bar network activity indicator. 66 | */ 67 | - (void)incrementActivityCount; 68 | 69 | /** 70 | Decrements the number of active network requests. If this number becomes zero after decrementing, this will stop animating the status bar network activity indicator. 71 | */ 72 | - (void)decrementActivityCount; 73 | 74 | @end 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /Pods/Reachability/Reachability.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Tony Million. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #import 29 | #import 30 | 31 | #import 32 | #import 33 | #import 34 | #import 35 | #import 36 | #import 37 | 38 | /** 39 | * Does ARC support GCD objects? 40 | * It does if the minimum deployment target is iOS 6+ or Mac OS X 8+ 41 | * 42 | * @see http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h 43 | **/ 44 | #if OS_OBJECT_USE_OBJC 45 | #define NEEDS_DISPATCH_RETAIN_RELEASE 0 46 | #else 47 | #define NEEDS_DISPATCH_RETAIN_RELEASE 1 48 | #endif 49 | 50 | /** 51 | * Create NS_ENUM macro if it does not exist on the targeted version of iOS or OS X. 52 | * 53 | * @see http://nshipster.com/ns_enum-ns_options/ 54 | **/ 55 | #ifndef NS_ENUM 56 | #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type 57 | #endif 58 | 59 | extern NSString *const kReachabilityChangedNotification; 60 | 61 | typedef NS_ENUM(NSInteger, NetworkStatus) { 62 | // Apple NetworkStatus Compatible Names. 63 | NotReachable = 0, 64 | ReachableViaWiFi = 2, 65 | ReachableViaWWAN = 1 66 | }; 67 | 68 | @class Reachability; 69 | 70 | typedef void (^NetworkReachable)(Reachability * reachability); 71 | typedef void (^NetworkUnreachable)(Reachability * reachability); 72 | 73 | @interface Reachability : NSObject 74 | 75 | @property (nonatomic, copy) NetworkReachable reachableBlock; 76 | @property (nonatomic, copy) NetworkUnreachable unreachableBlock; 77 | 78 | 79 | @property (nonatomic, assign) BOOL reachableOnWWAN; 80 | 81 | +(Reachability*)reachabilityWithHostname:(NSString*)hostname; 82 | +(Reachability*)reachabilityForInternetConnection; 83 | +(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress; 84 | +(Reachability*)reachabilityForLocalWiFi; 85 | 86 | -(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref; 87 | 88 | -(BOOL)startNotifier; 89 | -(void)stopNotifier; 90 | 91 | -(BOOL)isReachable; 92 | -(BOOL)isReachableViaWWAN; 93 | -(BOOL)isReachableViaWiFi; 94 | 95 | // WWAN may be available, but not active until a connection has been established. 96 | // WiFi may require a connection for VPN on Demand. 97 | -(BOOL)isConnectionRequired; // Identical DDG variant. 98 | -(BOOL)connectionRequired; // Apple's routine. 99 | // Dynamic, on demand connection? 100 | -(BOOL)isConnectionOnDemand; 101 | // Is user intervention required? 102 | -(BOOL)isInterventionRequired; 103 | 104 | -(NetworkStatus)currentReachabilityStatus; 105 | -(SCNetworkReachabilityFlags)reachabilityFlags; 106 | -(NSString*)currentReachabilityString; 107 | -(NSString*)currentReachabilityFlags; 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIRefreshControl+AFNetworking.m 2 | // 3 | // Copyright (c) 2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import "UIRefreshControl+AFNetworking.h" 24 | 25 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 26 | 27 | #import "AFHTTPRequestOperation.h" 28 | 29 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 30 | #import "AFURLSessionManager.h" 31 | #endif 32 | 33 | @implementation UIRefreshControl (AFNetworking) 34 | 35 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 36 | - (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task { 37 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 38 | 39 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; 40 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; 41 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; 42 | 43 | if (task) { 44 | if (task.state != NSURLSessionTaskStateCompleted) { 45 | if (task.state == NSURLSessionTaskStateRunning) { 46 | [self beginRefreshing]; 47 | } else { 48 | [self endRefreshing]; 49 | } 50 | 51 | [notificationCenter addObserver:self selector:@selector(af_beginRefreshing) name:AFNetworkingTaskDidResumeNotification object:task]; 52 | [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidCompleteNotification object:task]; 53 | [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidSuspendNotification object:task]; 54 | } 55 | } 56 | } 57 | #endif 58 | 59 | - (void)setRefreshingWithStateOfOperation:(AFURLConnectionOperation *)operation { 60 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 61 | 62 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidStartNotification object:nil]; 63 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidFinishNotification object:nil]; 64 | 65 | if (operation) { 66 | if (![operation isFinished]) { 67 | if ([operation isExecuting]) { 68 | [self beginRefreshing]; 69 | } else { 70 | [self endRefreshing]; 71 | } 72 | 73 | [notificationCenter addObserver:self selector:@selector(af_beginRefreshing) name:AFNetworkingOperationDidStartNotification object:operation]; 74 | [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingOperationDidFinishNotification object:operation]; 75 | } 76 | } 77 | } 78 | 79 | #pragma mark - 80 | 81 | - (void)af_beginRefreshing { 82 | dispatch_async(dispatch_get_main_queue(), ^{ 83 | [self beginRefreshing]; 84 | }); 85 | } 86 | 87 | - (void)af_endRefreshing { 88 | dispatch_async(dispatch_get_main_queue(), ^{ 89 | [self endRefreshing]; 90 | }); 91 | } 92 | 93 | @end 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIActivityIndicatorView+AFNetworking.m 2 | // 3 | // Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import "UIActivityIndicatorView+AFNetworking.h" 24 | 25 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 26 | 27 | #import "AFHTTPRequestOperation.h" 28 | 29 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 30 | #import "AFURLSessionManager.h" 31 | #endif 32 | 33 | @implementation UIActivityIndicatorView (AFNetworking) 34 | 35 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 36 | - (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task { 37 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 38 | 39 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; 40 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; 41 | [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; 42 | 43 | if (task) { 44 | if (task.state != NSURLSessionTaskStateCompleted) { 45 | if (task.state == NSURLSessionTaskStateRunning) { 46 | [self startAnimating]; 47 | } else { 48 | [self stopAnimating]; 49 | } 50 | 51 | [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingTaskDidResumeNotification object:task]; 52 | [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidCompleteNotification object:task]; 53 | [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidSuspendNotification object:task]; 54 | } 55 | } 56 | } 57 | #endif 58 | 59 | #pragma mark - 60 | 61 | - (void)setAnimatingWithStateOfOperation:(AFURLConnectionOperation *)operation { 62 | NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; 63 | 64 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidStartNotification object:nil]; 65 | [notificationCenter removeObserver:self name:AFNetworkingOperationDidFinishNotification object:nil]; 66 | 67 | if (operation) { 68 | if (![operation isFinished]) { 69 | if ([operation isExecuting]) { 70 | [self startAnimating]; 71 | } else { 72 | [self stopAnimating]; 73 | } 74 | 75 | [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingOperationDidStartNotification object:operation]; 76 | [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingOperationDidFinishNotification object:operation]; 77 | } 78 | } 79 | } 80 | 81 | #pragma mark - 82 | 83 | - (void)af_startAnimating { 84 | dispatch_async(dispatch_get_main_queue(), ^{ 85 | [self startAnimating]; 86 | }); 87 | } 88 | 89 | - (void)af_stopAnimating { 90 | dispatch_async(dispatch_get_main_queue(), ^{ 91 | [self stopAnimating]; 92 | }); 93 | } 94 | 95 | @end 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h: -------------------------------------------------------------------------------- 1 | // AFHTTPRequestOperation.h 2 | // 3 | // Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | #import "AFURLConnectionOperation.h" 25 | 26 | /** 27 | `AFHTTPRequestOperation` is a subclass of `AFURLConnectionOperation` for requests using the HTTP or HTTPS protocols. It encapsulates the concept of acceptable status codes and content types, which determine the success or failure of a request. 28 | */ 29 | @interface AFHTTPRequestOperation : AFURLConnectionOperation 30 | 31 | ///------------------------------------------------ 32 | /// @name Getting HTTP URL Connection Information 33 | ///------------------------------------------------ 34 | 35 | /** 36 | The last HTTP response received by the operation's connection. 37 | */ 38 | @property (readonly, nonatomic, strong) NSHTTPURLResponse *response; 39 | 40 | /** 41 | Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an AFHTTPResponse serializer, which uses the raw data as its response object. The serializer validates the status code to be in the `2XX` range, denoting success. If the response serializer generates an error in `-responseObjectForResponse:data:error:`, the `failure` callback of the session task or request operation will be executed; otherwise, the `success` callback will be executed. 42 | 43 | @warning `responseSerializer` must not be `nil`. Setting a response serializer will clear out any cached value 44 | */ 45 | @property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; 46 | 47 | /** 48 | An object constructed by the `responseSerializer` from the response and response data. Returns `nil` unless the operation `isFinished`, has a `response`, and has `responseData` with non-zero content length. If an error occurs during serialization, `nil` will be returned, and the `error` property will be populated with the serialization error. 49 | */ 50 | @property (readonly, nonatomic, strong) id responseObject; 51 | 52 | ///----------------------------------------------------------- 53 | /// @name Setting Completion Block Success / Failure Callbacks 54 | ///----------------------------------------------------------- 55 | 56 | /** 57 | Sets the `completionBlock` property with a block that executes either the specified success or failure block, depending on the state of the request on completion. If `error` returns a value, which can be caused by an unacceptable status code or content type, then `failure` is executed. Otherwise, `success` is executed. 58 | 59 | This method should be overridden in subclasses in order to specify the response object passed into the success block. 60 | 61 | @param success The block to be executed on the completion of a successful request. This block has no return value and takes two arguments: the receiver operation and the object constructed from the response data of the request. 62 | @param failure The block to be executed on the completion of an unsuccessful request. This block has no return value and takes two arguments: the receiver operation and the error that occurred during the request. 63 | */ 64 | - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success 65 | failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /RTLibrary-ios/RTHttpClient.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTHttpClient.m 3 | // ZLYDoc 4 | // 5 | // Created by Ryan on 14-4-10. 6 | // Copyright (c) 2014年 ZLY. All rights reserved. 7 | // 8 | 9 | #import "RTHttpClient.h" 10 | #import "Reachability.h"//pod 'Reachability', '~> 3.1.1' 11 | #import "RTJSONResponseSerializerWithData.h" 12 | 13 | @interface RTHttpClient() 14 | @property(nonatomic,strong) AFHTTPSessionManager *manager; 15 | @end 16 | 17 | @implementation RTHttpClient 18 | 19 | - (id)init{ 20 | if (self = [super init]){ 21 | self.manager = [AFHTTPSessionManager manager]; 22 | //请求参数序列化类型 23 | self.manager.requestSerializer = [AFJSONRequestSerializer serializer]; 24 | //响应结果序列化类型 25 | self.manager.responseSerializer = [RTJSONResponseSerializerWithData serializer]; 26 | } 27 | return self; 28 | } 29 | 30 | + (RTHttpClient *)defaultClient 31 | { 32 | static RTHttpClient *instance = nil; 33 | static dispatch_once_t predicate; 34 | dispatch_once(&predicate, ^{ 35 | instance = [[self alloc] init]; 36 | }); 37 | return instance; 38 | } 39 | 40 | - (void)requestWithPath:(NSString *)url 41 | method:(NSInteger)method 42 | parameters:(id)parameters prepareExecute:(PrepareExecuteBlock)prepareExecute 43 | success:(void (^)(NSURLSessionDataTask *, id))success 44 | failure:(void (^)(NSURLSessionDataTask *, NSError *))failure 45 | { 46 | //请求的URL 47 | DLog(@"Request path:%@",url); 48 | 49 | //判断网络状况(有链接:执行请求;无链接:弹出提示) 50 | if ([self isConnectionAvailable]) { 51 | //预处理(显示加载信息啥的) 52 | if (prepareExecute) { 53 | prepareExecute(); 54 | } 55 | switch (method) { 56 | case RTHttpRequestGet: 57 | { 58 | [self.manager GET:url parameters:parameters success:success failure:failure]; 59 | } 60 | break; 61 | case RTHttpRequestPost: 62 | { 63 | [self.manager POST:url parameters:parameters success:success failure:failure]; 64 | } 65 | break; 66 | case RTHttpRequestDelete: 67 | { 68 | [self.manager DELETE:url parameters:parameters success:success failure:failure]; 69 | } 70 | break; 71 | case RTHttpRequestPut: 72 | { 73 | [self.manager PUT:url parameters:parameters success:success failure:false]; 74 | } 75 | break; 76 | default: 77 | break; 78 | } 79 | }else{ 80 | //网络错误咯 81 | [self showExceptionDialog]; 82 | //发出网络异常通知广播 83 | [[NSNotificationCenter defaultCenter] postNotificationName:@"k_NOTI_NETWORK_ERROR" object:nil]; 84 | } 85 | 86 | } 87 | 88 | - (void)requestWithPathInHEAD:(NSString *)url 89 | parameters:(NSDictionary *)parameters 90 | success:(void (^)(NSURLSessionDataTask *task))success 91 | failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure 92 | { 93 | if ([self isConnectionAvailable]) { 94 | [self.manager HEAD:url parameters:parameters success:success failure:failure]; 95 | }else{ 96 | [self showExceptionDialog]; 97 | } 98 | } 99 | 100 | //看看网络是不是给力 101 | - (BOOL)isConnectionAvailable{ 102 | // Create zero addy 103 | struct sockaddr_in zeroAddress; 104 | bzero(&zeroAddress, sizeof(zeroAddress)); 105 | zeroAddress.sin_len = sizeof(zeroAddress); 106 | zeroAddress.sin_family = AF_INET; 107 | 108 | // Recover reachability flags 109 | SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress); 110 | SCNetworkReachabilityFlags flags; 111 | 112 | BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags); 113 | CFRelease(defaultRouteReachability); 114 | 115 | if (!didRetrieveFlags) 116 | { 117 | DLog(@"Error. Could not recover network reachability flags"); 118 | return NO; 119 | } 120 | BOOL isReachable = ((flags & kSCNetworkFlagsReachable) != 0); 121 | BOOL needsConnection = ((flags & kSCNetworkFlagsConnectionRequired) != 0); 122 | return (isReachable && !needsConnection) ? YES : NO; 123 | } 124 | 125 | //弹出网络错误提示框 126 | - (void)showExceptionDialog 127 | { 128 | [[[UIAlertView alloc] initWithTitle:@"提示" 129 | message:@"网络异常,请检查网络连接" 130 | delegate:self 131 | cancelButtonTitle:@"好的" 132 | otherButtonTitles:nil, nil] show]; 133 | } 134 | 135 | @end 136 | -------------------------------------------------------------------------------- /Pods/Pods-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## AFNetworking 5 | 6 | Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com/) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | 27 | ## FMDB 28 | 29 | If you are using fmdb in your project, I'd love to hear about it. Let me 30 | know at gus@flyingmeat.com. 31 | 32 | In short, this is the MIT License. 33 | 34 | Copyright (c) 2008 Flying Meat Inc. 35 | 36 | Permission is hereby granted, free of charge, to any person obtaining a copy 37 | of this software and associated documentation files (the "Software"), to deal 38 | in the Software without restriction, including without limitation the rights 39 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 40 | copies of the Software, and to permit persons to whom the Software is 41 | furnished to do so, subject to the following conditions: 42 | 43 | The above copyright notice and this permission notice shall be included in 44 | all copies or substantial portions of the Software. 45 | 46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 47 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 48 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 49 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 50 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 51 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 52 | THE SOFTWARE. 53 | 54 | ## Reachability 55 | 56 | Copyright (c) 2011, Tony Million. 57 | All rights reserved. 58 | 59 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 60 | 61 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 62 | 63 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 64 | 65 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 66 | 67 | 68 | ## SVProgressHUD 69 | 70 | Copyright (c) 2011 Sam Vermette 71 | 72 | Permission is hereby granted, free of charge, to any person 73 | obtaining a copy of this software and associated documentation 74 | files (the "Software"), to deal in the Software without 75 | restriction, including without limitation the rights to use, 76 | copy, modify, merge, publish, distribute, sublicense, and/or sell 77 | copies of the Software, and to permit persons to whom the 78 | Software is furnished to do so, subject to the following 79 | conditions: 80 | 81 | The above copyright notice and this permission notice shall be 82 | included in all copies or substantial portions of the Software. 83 | 84 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 85 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 86 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 87 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 88 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 89 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 90 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 91 | OTHER DEALINGS IN THE SOFTWARE. 92 | 93 | A different license may apply to other ressources included in this package, 94 | including Joseph Wain's Glyphish Icons. Please consult their 95 | respective headers for the terms of their individual licenses. 96 | Generated by CocoaPods - http://cocoapods.org 97 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIAlertView+AFNetworking.h 2 | // 3 | // Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | @class AFURLConnectionOperation; 32 | 33 | /** 34 | This category adds methods to the UIKit framework's `UIAlertView` class. The methods in this category provide support for automatically showing an alert if a session task or request operation finishes with an error. Alert title and message are filled from the corresponding `localizedDescription` & `localizedRecoverySuggestion` or `localizedFailureReason` of the error. 35 | */ 36 | @interface UIAlertView (AFNetworking) 37 | 38 | ///------------------------------------- 39 | /// @name Showing Alert for Session Task 40 | ///------------------------------------- 41 | 42 | /** 43 | Shows an alert view with the error of the specified session task, if any. 44 | 45 | @param task The session task. 46 | @param delegate The alert view delegate. 47 | */ 48 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 49 | + (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task 50 | delegate:(id)delegate; 51 | #endif 52 | 53 | /** 54 | Shows an alert view with the error of the specified session task, if any, with a custom cancel button title and other button titles. 55 | 56 | @param task The session task. 57 | @param delegate The alert view delegate. 58 | @param cancelButtonTitle The title of the cancel button or nil if there is no cancel button. Using this argument is equivalent to setting the cancel button index to the value returned by invoking addButtonWithTitle: specifying this title. 59 | @param otherButtonTitles The title of another button. Using this argument is equivalent to invoking addButtonWithTitle: with this title to add more buttons. Too many buttons can cause the alert view to scroll. For guidelines on the best ways to use an alert in an app, see "Temporary Views". Titles of additional buttons to add to the receiver, terminated with `nil`. 60 | */ 61 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 62 | + (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task 63 | delegate:(id)delegate 64 | cancelButtonTitle:(NSString *)cancelButtonTitle 65 | otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION; 66 | #endif 67 | 68 | ///------------------------------------------ 69 | /// @name Showing Alert for Request Operation 70 | ///------------------------------------------ 71 | 72 | /** 73 | Shows an alert view with the error of the specified request operation, if any. 74 | 75 | @param operation The request operation. 76 | @param delegate The alert view delegate. 77 | */ 78 | + (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation 79 | delegate:(id)delegate; 80 | 81 | /** 82 | Shows an alert view with the error of the specified request operation, if any, with a custom cancel button title and other button titles. 83 | 84 | @param operation The request operation. 85 | @param delegate The alert view delegate. 86 | @param cancelButtonTitle The title of the cancel button or nil if there is no cancel button. Using this argument is equivalent to setting the cancel button index to the value returned by invoking addButtonWithTitle: specifying this title. 87 | @param otherButtonTitles The title of another button. Using this argument is equivalent to invoking addButtonWithTitle: with this title to add more buttons. Too many buttons can cause the alert view to scroll. For guidelines on the best ways to use an alert in an app, see "Temporary Views". Titles of additional buttons to add to the receiver, terminated with `nil`. 88 | */ 89 | + (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation 90 | delegate:(id)delegate 91 | cancelButtonTitle:(NSString *)cancelButtonTitle 92 | otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION; 93 | 94 | @end 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h: -------------------------------------------------------------------------------- 1 | // AFSecurity.h 2 | // 3 | // Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | #import 25 | 26 | typedef NS_ENUM(NSUInteger, AFSSLPinningMode) { 27 | AFSSLPinningModeNone, 28 | AFSSLPinningModePublicKey, 29 | AFSSLPinningModeCertificate, 30 | }; 31 | 32 | /** 33 | `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections. 34 | 35 | Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled. 36 | */ 37 | @interface AFSecurityPolicy : NSObject 38 | 39 | /** 40 | The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`. 41 | */ 42 | @property (nonatomic, assign) AFSSLPinningMode SSLPinningMode; 43 | 44 | /** 45 | Whether to evaluate an entire SSL certificate chain, or just the leaf certificate. Defaults to `YES`. 46 | */ 47 | @property (nonatomic, assign) BOOL validatesCertificateChain; 48 | 49 | /** 50 | The certificates used to evaluate server trust according to the SSL pinning mode. By default, this property is set to any (`.cer`) certificates included in the app bundle. 51 | */ 52 | @property (nonatomic, strong) NSArray *pinnedCertificates; 53 | 54 | /** 55 | Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`. 56 | */ 57 | @property (nonatomic, assign) BOOL allowInvalidCertificates; 58 | 59 | /** 60 | Whether or not to validate the domain name in the certificates CN field. Defaults to `YES` for `AFSSLPinningModePublicKey` or `AFSSLPinningModeCertificate`, otherwise `NO`. 61 | */ 62 | @property (nonatomic, assign) BOOL validatesDomainName; 63 | 64 | ///----------------------------------------- 65 | /// @name Getting Specific Security Policies 66 | ///----------------------------------------- 67 | 68 | /** 69 | Returns the shared default security policy, which does not accept invalid certificates, and does not validate against pinned certificates or public keys. 70 | 71 | @return The default security policy. 72 | */ 73 | + (instancetype)defaultPolicy; 74 | 75 | ///--------------------- 76 | /// @name Initialization 77 | ///--------------------- 78 | 79 | /** 80 | Creates and returns a security policy with the specified pinning mode. 81 | 82 | @param pinningMode The SSL pinning mode. 83 | 84 | @return A new security policy. 85 | */ 86 | + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode; 87 | 88 | ///------------------------------ 89 | /// @name Evaluating Server Trust 90 | ///------------------------------ 91 | 92 | /** 93 | Whether or not the specified server trust should be accepted, based on the security policy. 94 | 95 | This method should be used when responding to an authentication challenge from a server. 96 | 97 | @param serverTrust The X.509 certificate trust of the server. 98 | 99 | @return Whether or not to trust the server. 100 | 101 | @warning This method has been deprecated in favor of `-evaluateServerTrust:forDomain:`. 102 | */ 103 | - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust DEPRECATED_ATTRIBUTE; 104 | 105 | /** 106 | Whether or not the specified server trust should be accepted, based on the security policy. 107 | 108 | This method should be used when responding to an authentication challenge from a server. 109 | 110 | @param serverTrust The X.509 certificate trust of the server. 111 | @param domain The domain of serverTrust. If `nil`, the domain will not be validated. 112 | 113 | @return Whether or not to trust the server. 114 | */ 115 | - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust 116 | forDomain:(NSString *)domain; 117 | 118 | @end 119 | 120 | ///---------------- 121 | /// @name Constants 122 | ///---------------- 123 | 124 | /** 125 | ## SSL Pinning Modes 126 | 127 | The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes. 128 | 129 | enum { 130 | AFSSLPinningModeNone, 131 | AFSSLPinningModePublicKey, 132 | AFSSLPinningModeCertificate, 133 | } 134 | 135 | `AFSSLPinningModeNone` 136 | Do not used pinned certificates to validate servers. 137 | 138 | `AFSSLPinningModePublicKey` 139 | Validate host certificates against public keys of pinned certificates. 140 | 141 | `AFSSLPinningModeCertificate` 142 | Validate host certificates against pinned certificates. 143 | */ 144 | -------------------------------------------------------------------------------- /RTLibrary-ios/AppUtils.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppUtils.m 3 | // zlydoc+iphone 4 | // 5 | // Created by Ryan on 14+5+23. 6 | // Copyright (c) 2014年 zlycare. All rights reserved. 7 | // 8 | 9 | #import "AppUtils.h" 10 | #import 11 | #import 12 | 13 | #define DEFAULT_VOID_COLOR [UIColor whiteColor] 14 | 15 | @implementation AppUtils 16 | 17 | /********************* System Utils **********************/ 18 | + (void)showAlertMessage:(NSString *)msg 19 | { 20 | UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:msg message:nil delegate:self cancelButtonTitle:@"好的" otherButtonTitles:nil, nil]; 21 | [alertView show]; 22 | } 23 | 24 | + (void)closeKeyboard 25 | { 26 | [[UIApplication sharedApplication].keyWindow endEditing:YES]; 27 | } 28 | 29 | + (NSString *)md5FromString:(NSString *)str 30 | { 31 | const char *cStr = [str UTF8String]; 32 | unsigned char result[16]; 33 | CC_MD5(cStr, (int)strlen(cStr), result); // This is the md5 call 34 | return [NSString stringWithFormat: 35 | @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", 36 | result[0], result[1], result[2], result[3], 37 | result[4], result[5], result[6], result[7], 38 | result[8], result[9], result[10], result[11], 39 | result[12], result[13], result[14], result[15] 40 | ]; 41 | } 42 | 43 | /******* UITableView & UINavigationController Utils *******/ 44 | + (UILabel *)tableViewsHeaderLabelWithMessage:(NSString *)message 45 | { 46 | UILabel *lb_headTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 50, 320, 20)]; 47 | lb_headTitle.font = [UIFont boldSystemFontOfSize:15.0]; 48 | lb_headTitle.textColor = [UIColor darkGrayColor]; 49 | lb_headTitle.textAlignment = NSTextAlignmentCenter; 50 | lb_headTitle.text = message; 51 | return lb_headTitle; 52 | } 53 | 54 | + (UIView *)tableViewsFooterView 55 | { 56 | UIView *coverView = [UIView new]; 57 | coverView.backgroundColor = [UIColor clearColor]; 58 | return coverView; 59 | } 60 | 61 | + (UIBarButtonItem *)navigationBackButtonWithNoTitle 62 | { 63 | return [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil]; 64 | } 65 | 66 | /********************* SVProgressHUD **********************/ 67 | + (void)showSuccessMessage:(NSString *)message 68 | { 69 | [SVProgressHUD showSuccessWithStatus:message]; 70 | } 71 | 72 | + (void)showErrorMessage:(NSString *)message 73 | { 74 | [SVProgressHUD showErrorWithStatus:message]; 75 | } 76 | 77 | + (void)showProgressMessage:(NSString *) message 78 | { 79 | [SVProgressHUD showWithStatus:message]; 80 | } 81 | 82 | + (void)dismissHUD 83 | { 84 | [SVProgressHUD dismiss]; 85 | } 86 | 87 | /********************** NSDate Utils ***********************/ 88 | + (NSString *)stringFromDate:(NSDate *)date formatter:(NSString *)formatter 89 | { 90 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; 91 | [dateFormatter setDateFormat:formatter]; 92 | return [dateFormatter stringFromDate:date]; 93 | } 94 | 95 | + (NSDate *)dateFromString:(NSString *)dateString formatter:(NSString *)formatter; 96 | { 97 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; 98 | [dateFormatter setDateFormat:formatter]; 99 | return [dateFormatter dateFromString:dateString]; 100 | } 101 | 102 | /********************* Category Utils **********************/ 103 | + (UIColor *)colorWithHexString:(NSString *)stringToConvert 104 | { 105 | NSString *cString = [[stringToConvert stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString]; 106 | 107 | if ([cString length] < 6) 108 | return DEFAULT_VOID_COLOR; 109 | if ([cString hasPrefix:@"#"]) 110 | cString = [cString substringFromIndex:1]; 111 | if ([cString length] != 6) 112 | return DEFAULT_VOID_COLOR; 113 | 114 | NSRange range; 115 | range.location = 0; 116 | range.length = 2; 117 | NSString *rString = [cString substringWithRange:range]; 118 | 119 | range.location = 2; 120 | NSString *gString = [cString substringWithRange:range]; 121 | 122 | range.location = 4; 123 | NSString *bString = [cString substringWithRange:range]; 124 | 125 | 126 | unsigned int r, g, b; 127 | [[NSScanner scannerWithString:rString] scanHexInt:&r]; 128 | [[NSScanner scannerWithString:gString] scanHexInt:&g]; 129 | [[NSScanner scannerWithString:bString] scanHexInt:&b]; 130 | 131 | return [UIColor colorWithRed:((float) r / 255.0f) 132 | green:((float) g / 255.0f) 133 | blue:((float) b / 255.0f) 134 | alpha:1.0f]; 135 | } 136 | 137 | /********************* Verification Utils **********************/ 138 | + (BOOL)checkPhoneNumber:(NSString *)phoneNumber{ 139 | 140 | NSString * MOBILE = @"^1(3[0-9]|5[0-35-9]|8[025-9])\\d{8}$"; 141 | NSString * CM = @"^1(34[0-8]|(3[5-9]|5[017-9]|8[278])\\d)\\d{7}$"; 142 | NSString * CU = @"^1(3[0-2]|5[256]|8[56])\\d{8}$"; 143 | NSString * CT = @"^1((33|53|8[09])[0-9]|349)\\d{7}$"; 144 | 145 | NSPredicate *regextestmobile = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", MOBILE]; 146 | NSPredicate *regextestcm = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CM]; 147 | NSPredicate *regextestcu = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CU]; 148 | NSPredicate *regextestct = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", CT]; 149 | BOOL res1 = [regextestmobile evaluateWithObject:phoneNumber]; 150 | BOOL res2 = [regextestcm evaluateWithObject:phoneNumber]; 151 | BOOL res3 = [regextestcu evaluateWithObject:phoneNumber]; 152 | BOOL res4 = [regextestct evaluateWithObject:phoneNumber]; 153 | 154 | if (res1 || res2 || res3 || res4 ) 155 | { 156 | return YES; 157 | } 158 | else 159 | { 160 | return NO; 161 | } 162 | } 163 | 164 | @end 165 | -------------------------------------------------------------------------------- /Pods/FMDB/src/fmdb/FMDatabasePool.h: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabasePool.h 3 | // fmdb 4 | // 5 | // Created by August Mueller on 6/22/11. 6 | // Copyright 2011 Flying Meat Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "sqlite3.h" 11 | 12 | @class FMDatabase; 13 | 14 | /** Pool of `` objects. 15 | 16 | ### See also 17 | 18 | - `` 19 | - `` 20 | 21 | @warning Before using `FMDatabasePool`, please consider using `` instead. 22 | 23 | If you really really really know what you're doing and `FMDatabasePool` is what 24 | you really really need (ie, you're using a read only database), OK you can use 25 | it. But just be careful not to deadlock! 26 | 27 | For an example on deadlocking, search for: 28 | `ONLY_USE_THE_POOL_IF_YOU_ARE_DOING_READS_OTHERWISE_YOULL_DEADLOCK_USE_FMDATABASEQUEUE_INSTEAD` 29 | in the main.m file. 30 | */ 31 | 32 | @interface FMDatabasePool : NSObject { 33 | NSString *_path; 34 | 35 | dispatch_queue_t _lockQueue; 36 | 37 | NSMutableArray *_databaseInPool; 38 | NSMutableArray *_databaseOutPool; 39 | 40 | __unsafe_unretained id _delegate; 41 | 42 | NSUInteger _maximumNumberOfDatabasesToCreate; 43 | int _openFlags; 44 | } 45 | 46 | /** Database path */ 47 | 48 | @property (atomic, retain) NSString *path; 49 | 50 | /** Delegate object */ 51 | 52 | @property (atomic, assign) id delegate; 53 | 54 | /** Maximum number of databases to create */ 55 | 56 | @property (atomic, assign) NSUInteger maximumNumberOfDatabasesToCreate; 57 | 58 | /** Open flags */ 59 | 60 | @property (atomic, readonly) int openFlags; 61 | 62 | 63 | ///--------------------- 64 | /// @name Initialization 65 | ///--------------------- 66 | 67 | /** Create pool using path. 68 | 69 | @param aPath The file path of the database. 70 | 71 | @return The `FMDatabasePool` object. `nil` on error. 72 | */ 73 | 74 | + (instancetype)databasePoolWithPath:(NSString*)aPath; 75 | 76 | /** Create pool using path and specified flags 77 | 78 | @param aPath The file path of the database. 79 | @param openFlags Flags passed to the openWithFlags method of the database 80 | 81 | @return The `FMDatabasePool` object. `nil` on error. 82 | */ 83 | 84 | + (instancetype)databasePoolWithPath:(NSString*)aPath flags:(int)openFlags; 85 | 86 | /** Create pool using path. 87 | 88 | @param aPath The file path of the database. 89 | 90 | @return The `FMDatabasePool` object. `nil` on error. 91 | */ 92 | 93 | - (instancetype)initWithPath:(NSString*)aPath; 94 | 95 | /** Create pool using path and specified flags. 96 | 97 | @param aPath The file path of the database. 98 | @param openFlags Flags passed to the openWithFlags method of the database 99 | 100 | @return The `FMDatabasePool` object. `nil` on error. 101 | */ 102 | 103 | - (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags; 104 | 105 | ///------------------------------------------------ 106 | /// @name Keeping track of checked in/out databases 107 | ///------------------------------------------------ 108 | 109 | /** Number of checked-in databases in pool 110 | 111 | @returns Number of databases 112 | */ 113 | 114 | - (NSUInteger)countOfCheckedInDatabases; 115 | 116 | /** Number of checked-out databases in pool 117 | 118 | @returns Number of databases 119 | */ 120 | 121 | - (NSUInteger)countOfCheckedOutDatabases; 122 | 123 | /** Total number of databases in pool 124 | 125 | @returns Number of databases 126 | */ 127 | 128 | - (NSUInteger)countOfOpenDatabases; 129 | 130 | /** Release all databases in pool */ 131 | 132 | - (void)releaseAllDatabases; 133 | 134 | ///------------------------------------------ 135 | /// @name Perform database operations in pool 136 | ///------------------------------------------ 137 | 138 | /** Synchronously perform database operations in pool. 139 | 140 | @param block The code to be run on the `FMDatabasePool` pool. 141 | */ 142 | 143 | - (void)inDatabase:(void (^)(FMDatabase *db))block; 144 | 145 | /** Synchronously perform database operations in pool using transaction. 146 | 147 | @param block The code to be run on the `FMDatabasePool` pool. 148 | */ 149 | 150 | - (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; 151 | 152 | /** Synchronously perform database operations in pool using deferred transaction. 153 | 154 | @param block The code to be run on the `FMDatabasePool` pool. 155 | */ 156 | 157 | - (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; 158 | 159 | #if SQLITE_VERSION_NUMBER >= 3007000 160 | 161 | /** Synchronously perform database operations in pool using save point. 162 | 163 | @param block The code to be run on the `FMDatabasePool` pool. 164 | 165 | @return `NSError` object if error; `nil` if successful. 166 | 167 | @warning You can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock. If you need to nest, use `<[FMDatabase startSavePointWithName:error:]>` instead. 168 | */ 169 | 170 | - (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block; 171 | #endif 172 | 173 | @end 174 | 175 | 176 | /** FMDatabasePool delegate category 177 | 178 | This is a category that defines the protocol for the FMDatabasePool delegate 179 | */ 180 | 181 | @interface NSObject (FMDatabasePoolDelegate) 182 | 183 | /** Asks the delegate whether database should be added to the pool. 184 | 185 | @param pool The `FMDatabasePool` object. 186 | @param database The `FMDatabase` object. 187 | 188 | @return `YES` if it should add database to pool; `NO` if not. 189 | 190 | */ 191 | 192 | - (BOOL)databasePool:(FMDatabasePool*)pool shouldAddDatabaseToPool:(FMDatabase*)database; 193 | 194 | /** Tells the delegate that database was added to the pool. 195 | 196 | @param pool The `FMDatabasePool` object. 197 | @param database The `FMDatabase` object. 198 | 199 | */ 200 | 201 | - (void)databasePool:(FMDatabasePool*)pool didAddDatabase:(FMDatabase*)database; 202 | 203 | @end 204 | 205 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIWebView+AFNetworking.h 2 | // 3 | // Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | @class AFHTTPRequestSerializer, AFHTTPResponseSerializer; 32 | @protocol AFURLRequestSerialization, AFURLResponseSerialization; 33 | 34 | /** 35 | This category adds methods to the UIKit framework's `UIWebView` class. The methods in this category provide increased control over the request cycle, including progress monitoring and success / failure handling. 36 | 37 | @discussion When using these category methods, make sure to assign `delegate` for the web view, which implements `–webView:shouldStartLoadWithRequest:navigationType:` appropriately. This allows for tapped links to be loaded through AFNetworking, and can ensure that `canGoBack` & `canGoForward` update their values correctly. 38 | */ 39 | @interface UIWebView (AFNetworking) 40 | 41 | /** 42 | The request serializer used to serialize requests made with the `-loadRequest:...` category methods. By default, this is an instance of `AFHTTPRequestSerializer`. 43 | */ 44 | @property (nonatomic, strong) AFHTTPRequestSerializer * requestSerializer; 45 | 46 | /** 47 | The response serializer used to serialize responses made with the `-loadRequest:...` category methods. By default, this is an instance of `AFHTTPResponseSerializer`. 48 | */ 49 | @property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; 50 | 51 | /** 52 | Asynchronously loads the specified request. 53 | 54 | @param request A URL request identifying the location of the content to load. This must not be `nil`. 55 | @param progress A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the main thread. 56 | @param success A block object to be executed when the request finishes loading successfully. This block returns the HTML string to be loaded by the web view, and takes two arguments: the response, and the response string. 57 | @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred. 58 | */ 59 | - (void)loadRequest:(NSURLRequest *)request 60 | progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress 61 | success:(NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success 62 | failure:(void (^)(NSError *error))failure; 63 | 64 | /** 65 | Asynchronously loads the data associated with a particular request with a specified MIME type and text encoding. 66 | 67 | @param request A URL request identifying the location of the content to load. This must not be `nil`. 68 | @param MIMEType The MIME type of the content. Defaults to the content type of the response if not specified. 69 | @param textEncodingName The IANA encoding name, as in `utf-8` or `utf-16`. Defaults to the response text encoding if not specified. 70 | @param progress A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the main thread. 71 | @param success A block object to be executed when the request finishes loading successfully. This block returns the data to be loaded by the web view and takes two arguments: the response, and the downloaded data. 72 | @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred. 73 | */ 74 | - (void)loadRequest:(NSURLRequest *)request 75 | MIMEType:(NSString *)MIMEType 76 | textEncodingName:(NSString *)textEncodingName 77 | progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress 78 | success:(NSData * (^)(NSHTTPURLResponse *response, NSData *data))success 79 | failure:(void (^)(NSError *error))failure; 80 | 81 | @end 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIAlertView+AFNetworking.m 2 | // 3 | // Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import "UIAlertView+AFNetworking.h" 24 | 25 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 26 | 27 | #import "AFURLConnectionOperation.h" 28 | 29 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 30 | #import "AFURLSessionManager.h" 31 | #endif 32 | 33 | static void AFGetAlertViewTitleAndMessageFromError(NSError *error, NSString * __autoreleasing *title, NSString * __autoreleasing *message) { 34 | if (error.localizedDescription && (error.localizedRecoverySuggestion || error.localizedFailureReason)) { 35 | *title = error.localizedDescription; 36 | 37 | if (error.localizedRecoverySuggestion) { 38 | *message = error.localizedRecoverySuggestion; 39 | } else { 40 | *message = error.localizedFailureReason; 41 | } 42 | } else if (error.localizedDescription) { 43 | *title = NSLocalizedStringFromTable(@"Error", @"AFNetworking", @"Fallback Error Description"); 44 | *message = error.localizedDescription; 45 | } else { 46 | *title = NSLocalizedStringFromTable(@"Error", @"AFNetworking", @"Fallback Error Description"); 47 | *message = [NSString stringWithFormat:NSLocalizedStringFromTable(@"%@ Error: %ld", @"AFNetworking", @"Fallback Error Failure Reason Format"), error.domain, (long)error.code]; 48 | } 49 | } 50 | 51 | @implementation UIAlertView (AFNetworking) 52 | 53 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 54 | + (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task 55 | delegate:(id)delegate 56 | { 57 | [self showAlertViewForTaskWithErrorOnCompletion:task delegate:delegate cancelButtonTitle:NSLocalizedStringFromTable(@"Dismiss", @"AFNetworking", @"UIAlertView Cancel Button Title") otherButtonTitles:nil, nil]; 58 | } 59 | 60 | + (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task 61 | delegate:(id)delegate 62 | cancelButtonTitle:(NSString *)cancelButtonTitle 63 | otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION 64 | { 65 | __block id observer = [[NSNotificationCenter defaultCenter] addObserverForName:AFNetworkingTaskDidCompleteNotification object:task queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) { 66 | 67 | NSError *error = notification.userInfo[AFNetworkingTaskDidCompleteErrorKey]; 68 | if (error) { 69 | NSString *title, *message; 70 | AFGetAlertViewTitleAndMessageFromError(error, &title, &message); 71 | 72 | [[[UIAlertView alloc] initWithTitle:title message:message delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:otherButtonTitles, nil] show]; 73 | } 74 | 75 | [[NSNotificationCenter defaultCenter] removeObserver:observer name:AFNetworkingTaskDidCompleteNotification object:notification.object]; 76 | }]; 77 | } 78 | #endif 79 | 80 | #pragma mark - 81 | 82 | + (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation 83 | delegate:(id)delegate 84 | { 85 | [self showAlertViewForRequestOperationWithErrorOnCompletion:operation delegate:delegate cancelButtonTitle:NSLocalizedStringFromTable(@"Dismiss", @"AFNetworking", @"UIAlert View Cancel Button Title") otherButtonTitles:nil, nil]; 86 | } 87 | 88 | + (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation 89 | delegate:(id)delegate 90 | cancelButtonTitle:(NSString *)cancelButtonTitle 91 | otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION 92 | { 93 | __block id observer = [[NSNotificationCenter defaultCenter] addObserverForName:AFNetworkingOperationDidFinishNotification object:operation queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) { 94 | 95 | if (notification.object && [notification.object isKindOfClass:[AFURLConnectionOperation class]]) { 96 | NSError *error = [(AFURLConnectionOperation *)notification.object error]; 97 | if (error) { 98 | NSString *title, *message; 99 | AFGetAlertViewTitleAndMessageFromError(error, &title, &message); 100 | 101 | [[[UIAlertView alloc] initWithTitle:title message:message delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:otherButtonTitles, nil] show]; 102 | } 103 | } 104 | 105 | [[NSNotificationCenter defaultCenter] removeObserver:observer name:AFNetworkingOperationDidFinishNotification object:notification.object]; 106 | }]; 107 | } 108 | 109 | @end 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /Pods/FMDB/src/fmdb/FMDatabaseQueue.h: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabaseQueue.h 3 | // fmdb 4 | // 5 | // Created by August Mueller on 6/22/11. 6 | // Copyright 2011 Flying Meat Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "sqlite3.h" 11 | 12 | @class FMDatabase; 13 | 14 | /** To perform queries and updates on multiple threads, you'll want to use `FMDatabaseQueue`. 15 | 16 | Using a single instance of `` from multiple threads at once is a bad idea. It has always been OK to make a `` object *per thread*. Just don't share a single instance across threads, and definitely not across multiple threads at the same time. 17 | 18 | Instead, use `FMDatabaseQueue`. Here's how to use it: 19 | 20 | First, make your queue. 21 | 22 | FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:aPath]; 23 | 24 | Then use it like so: 25 | 26 | [queue inDatabase:^(FMDatabase *db) { 27 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:1]]; 28 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:2]]; 29 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:3]]; 30 | 31 | FMResultSet *rs = [db executeQuery:@"select * from foo"]; 32 | while ([rs next]) { 33 | //… 34 | } 35 | }]; 36 | 37 | An easy way to wrap things up in a transaction can be done like this: 38 | 39 | [queue inTransaction:^(FMDatabase *db, BOOL *rollback) { 40 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:1]]; 41 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:2]]; 42 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:3]]; 43 | 44 | if (whoopsSomethingWrongHappened) { 45 | *rollback = YES; 46 | return; 47 | } 48 | // etc… 49 | [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:4]]; 50 | }]; 51 | 52 | `FMDatabaseQueue` will run the blocks on a serialized queue (hence the name of the class). So if you call `FMDatabaseQueue`'s methods from multiple threads at the same time, they will be executed in the order they are received. This way queries and updates won't step on each other's toes, and every one is happy. 53 | 54 | ### See also 55 | 56 | - `` 57 | 58 | @warning Do not instantiate a single `` object and use it across multiple threads. Use `FMDatabaseQueue` instead. 59 | 60 | @warning The calls to `FMDatabaseQueue`'s methods are blocking. So even though you are passing along blocks, they will **not** be run on another thread. 61 | 62 | */ 63 | 64 | @interface FMDatabaseQueue : NSObject { 65 | NSString *_path; 66 | dispatch_queue_t _queue; 67 | FMDatabase *_db; 68 | int _openFlags; 69 | } 70 | 71 | /** Path of database */ 72 | 73 | @property (atomic, retain) NSString *path; 74 | 75 | /** Open flags */ 76 | 77 | @property (atomic, readonly) int openFlags; 78 | 79 | ///---------------------------------------------------- 80 | /// @name Initialization, opening, and closing of queue 81 | ///---------------------------------------------------- 82 | 83 | /** Create queue using path. 84 | 85 | @param aPath The file path of the database. 86 | 87 | @return The `FMDatabaseQueue` object. `nil` on error. 88 | */ 89 | 90 | + (instancetype)databaseQueueWithPath:(NSString*)aPath; 91 | 92 | /** Create queue using path and specified flags. 93 | 94 | @param aPath The file path of the database. 95 | @param openFlags Flags passed to the openWithFlags method of the database 96 | 97 | @return The `FMDatabaseQueue` object. `nil` on error. 98 | */ 99 | + (instancetype)databaseQueueWithPath:(NSString*)aPath flags:(int)openFlags; 100 | 101 | /** Create queue using path. 102 | 103 | @param aPath The file path of the database. 104 | 105 | @return The `FMDatabaseQueue` object. `nil` on error. 106 | */ 107 | 108 | - (instancetype)initWithPath:(NSString*)aPath; 109 | 110 | /** Create queue using path and specified flags. 111 | 112 | @param aPath The file path of the database. 113 | @param openFlags Flags passed to the openWithFlags method of the database 114 | 115 | @return The `FMDatabaseQueue` object. `nil` on error. 116 | */ 117 | 118 | - (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags; 119 | 120 | /** Returns the Class of 'FMDatabase' subclass, that will be used to instantiate database object. 121 | 122 | Subclasses can override this method to return specified Class of 'FMDatabase' subclass. 123 | 124 | @return The Class of 'FMDatabase' subclass, that will be used to instantiate database object. 125 | */ 126 | 127 | + (Class)databaseClass; 128 | 129 | /** Close database used by queue. */ 130 | 131 | - (void)close; 132 | 133 | ///----------------------------------------------- 134 | /// @name Dispatching database operations to queue 135 | ///----------------------------------------------- 136 | 137 | /** Synchronously perform database operations on queue. 138 | 139 | @param block The code to be run on the queue of `FMDatabaseQueue` 140 | */ 141 | 142 | - (void)inDatabase:(void (^)(FMDatabase *db))block; 143 | 144 | /** Synchronously perform database operations on queue, using transactions. 145 | 146 | @param block The code to be run on the queue of `FMDatabaseQueue` 147 | */ 148 | 149 | - (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; 150 | 151 | /** Synchronously perform database operations on queue, using deferred transactions. 152 | 153 | @param block The code to be run on the queue of `FMDatabaseQueue` 154 | */ 155 | 156 | - (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; 157 | 158 | ///----------------------------------------------- 159 | /// @name Dispatching database operations to queue 160 | ///----------------------------------------------- 161 | 162 | /** Synchronously perform database operations using save point. 163 | 164 | @param block The code to be run on the queue of `FMDatabaseQueue` 165 | */ 166 | 167 | #if SQLITE_VERSION_NUMBER >= 3007000 168 | // NOTE: you can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock. 169 | // If you need to nest, use FMDatabase's startSavePointWithName:error: instead. 170 | - (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block; 171 | #endif 172 | 173 | @end 174 | 175 | -------------------------------------------------------------------------------- /Pods/Pods-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com/) 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | Title 38 | AFNetworking 39 | Type 40 | PSGroupSpecifier 41 | 42 | 43 | FooterText 44 | If you are using fmdb in your project, I'd love to hear about it. Let me 45 | know at gus@flyingmeat.com. 46 | 47 | In short, this is the MIT License. 48 | 49 | Copyright (c) 2008 Flying Meat Inc. 50 | 51 | Permission is hereby granted, free of charge, to any person obtaining a copy 52 | of this software and associated documentation files (the "Software"), to deal 53 | in the Software without restriction, including without limitation the rights 54 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 55 | copies of the Software, and to permit persons to whom the Software is 56 | furnished to do so, subject to the following conditions: 57 | 58 | The above copyright notice and this permission notice shall be included in 59 | all copies or substantial portions of the Software. 60 | 61 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 62 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 63 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 64 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 65 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 66 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 67 | THE SOFTWARE. 68 | Title 69 | FMDB 70 | Type 71 | PSGroupSpecifier 72 | 73 | 74 | FooterText 75 | Copyright (c) 2011, Tony Million. 76 | All rights reserved. 77 | 78 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 79 | 80 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 81 | 82 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 83 | 84 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 85 | 86 | Title 87 | Reachability 88 | Type 89 | PSGroupSpecifier 90 | 91 | 92 | FooterText 93 | Copyright (c) 2011 Sam Vermette 94 | 95 | Permission is hereby granted, free of charge, to any person 96 | obtaining a copy of this software and associated documentation 97 | files (the "Software"), to deal in the Software without 98 | restriction, including without limitation the rights to use, 99 | copy, modify, merge, publish, distribute, sublicense, and/or sell 100 | copies of the Software, and to permit persons to whom the 101 | Software is furnished to do so, subject to the following 102 | conditions: 103 | 104 | The above copyright notice and this permission notice shall be 105 | included in all copies or substantial portions of the Software. 106 | 107 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 108 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 109 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 110 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 111 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 112 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 113 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 114 | OTHER DEALINGS IN THE SOFTWARE. 115 | 116 | A different license may apply to other ressources included in this package, 117 | including Joseph Wain's Glyphish Icons. Please consult their 118 | respective headers for the terms of their individual licenses. 119 | Title 120 | SVProgressHUD 121 | Type 122 | PSGroupSpecifier 123 | 124 | 125 | FooterText 126 | Generated by CocoaPods - http://cocoapods.org 127 | Title 128 | 129 | Type 130 | PSGroupSpecifier 131 | 132 | 133 | StringsTable 134 | Acknowledgements 135 | Title 136 | Acknowledgements 137 | 138 | 139 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m: -------------------------------------------------------------------------------- 1 | // UIWebView+AFNetworking.m 2 | // 3 | // Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import "UIWebView+AFNetworking.h" 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import "AFHTTPRequestOperation.h" 30 | #import "AFURLResponseSerialization.h" 31 | #import "AFURLRequestSerialization.h" 32 | 33 | @interface UIWebView (_AFNetworking) 34 | @property (readwrite, nonatomic, strong, setter = af_setHTTPRequestOperation:) AFHTTPRequestOperation *af_HTTPRequestOperation; 35 | @end 36 | 37 | @implementation UIWebView (_AFNetworking) 38 | 39 | - (AFHTTPRequestOperation *)af_HTTPRequestOperation { 40 | return (AFHTTPRequestOperation *)objc_getAssociatedObject(self, @selector(af_HTTPRequestOperation)); 41 | } 42 | 43 | - (void)af_setHTTPRequestOperation:(AFHTTPRequestOperation *)operation { 44 | objc_setAssociatedObject(self, @selector(af_HTTPRequestOperation), operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 45 | } 46 | 47 | @end 48 | 49 | #pragma mark - 50 | 51 | @implementation UIWebView (AFNetworking) 52 | 53 | - (AFHTTPRequestSerializer *)requestSerializer { 54 | static AFHTTPRequestSerializer *_af_defaultRequestSerializer = nil; 55 | static dispatch_once_t onceToken; 56 | dispatch_once(&onceToken, ^{ 57 | _af_defaultRequestSerializer = [AFHTTPRequestSerializer serializer]; 58 | }); 59 | 60 | #pragma clang diagnostic push 61 | #pragma clang diagnostic ignored "-Wgnu" 62 | return objc_getAssociatedObject(self, @selector(requestSerializer)) ?: _af_defaultRequestSerializer; 63 | #pragma clang diagnostic pop 64 | } 65 | 66 | - (void)setRequestSerializer:(AFHTTPRequestSerializer *)requestSerializer { 67 | objc_setAssociatedObject(self, @selector(requestSerializer), requestSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 68 | } 69 | 70 | - (AFHTTPResponseSerializer *)responseSerializer { 71 | static AFHTTPResponseSerializer *_af_defaultResponseSerializer = nil; 72 | static dispatch_once_t onceToken; 73 | dispatch_once(&onceToken, ^{ 74 | _af_defaultResponseSerializer = [AFHTTPResponseSerializer serializer]; 75 | }); 76 | 77 | #pragma clang diagnostic push 78 | #pragma clang diagnostic ignored "-Wgnu" 79 | return objc_getAssociatedObject(self, @selector(responseSerializer)) ?: _af_defaultResponseSerializer; 80 | #pragma clang diagnostic pop 81 | } 82 | 83 | - (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { 84 | objc_setAssociatedObject(self, @selector(responseSerializer), responseSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 85 | } 86 | 87 | #pragma mark - 88 | 89 | - (void)loadRequest:(NSURLRequest *)request 90 | progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress 91 | success:(NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success 92 | failure:(void (^)(NSError *error))failure 93 | { 94 | [self loadRequest:request MIMEType:nil textEncodingName:nil progress:progress success:^NSData *(NSHTTPURLResponse *response, NSData *data) { 95 | NSStringEncoding stringEncoding = NSUTF8StringEncoding; 96 | if (response.textEncodingName) { 97 | CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)response.textEncodingName); 98 | if (encoding != kCFStringEncodingInvalidId) { 99 | stringEncoding = CFStringConvertEncodingToNSStringEncoding(encoding); 100 | } 101 | } 102 | 103 | NSString *string = [[NSString alloc] initWithData:data encoding:stringEncoding]; 104 | if (success) { 105 | string = success(response, string); 106 | } 107 | 108 | return [string dataUsingEncoding:stringEncoding]; 109 | } failure:failure]; 110 | } 111 | 112 | - (void)loadRequest:(NSURLRequest *)request 113 | MIMEType:(NSString *)MIMEType 114 | textEncodingName:(NSString *)textEncodingName 115 | progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress 116 | success:(NSData * (^)(NSHTTPURLResponse *response, NSData *data))success 117 | failure:(void (^)(NSError *error))failure 118 | { 119 | NSParameterAssert(request); 120 | 121 | if (self.af_HTTPRequestOperation) { 122 | [self.af_HTTPRequestOperation cancel]; 123 | } 124 | 125 | request = [self.requestSerializer requestBySerializingRequest:request withParameters:nil error:nil]; 126 | 127 | self.af_HTTPRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; 128 | self.af_HTTPRequestOperation.responseSerializer = self.responseSerializer; 129 | 130 | __weak __typeof(self)weakSelf = self; 131 | [self.af_HTTPRequestOperation setDownloadProgressBlock:progress]; 132 | [self.af_HTTPRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id __unused responseObject) { 133 | NSData *data = success ? success(operation.response, operation.responseData) : operation.responseData; 134 | 135 | #pragma clang diagnostic push 136 | #pragma clang diagnostic ignored "-Wgnu" 137 | __strong __typeof(weakSelf) strongSelf = weakSelf; 138 | [strongSelf loadData:data MIMEType:(MIMEType ?: [operation.response MIMEType]) textEncodingName:(textEncodingName ?: [operation.response textEncodingName]) baseURL:[operation.response URL]]; 139 | #pragma clang diagnostic pop 140 | } failure:^(AFHTTPRequestOperation * __unused operation, NSError *error) { 141 | if (failure) { 142 | failure(error); 143 | } 144 | }]; 145 | 146 | [self.af_HTTPRequestOperation start]; 147 | } 148 | 149 | @end 150 | 151 | #endif 152 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m: -------------------------------------------------------------------------------- 1 | // AFNetworkActivityIndicatorManager.m 2 | // 3 | // Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import "AFNetworkActivityIndicatorManager.h" 24 | 25 | #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) 26 | 27 | #import "AFHTTPRequestOperation.h" 28 | 29 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 30 | #import "AFURLSessionManager.h" 31 | #endif 32 | 33 | static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.17; 34 | 35 | static NSURLRequest * AFNetworkRequestFromNotification(NSNotification *notification) { 36 | if ([[notification object] isKindOfClass:[AFURLConnectionOperation class]]) { 37 | return [(AFURLConnectionOperation *)[notification object] request]; 38 | } 39 | 40 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 41 | if ([[notification object] respondsToSelector:@selector(originalRequest)]) { 42 | return [(NSURLSessionTask *)[notification object] originalRequest]; 43 | } 44 | #endif 45 | 46 | return nil; 47 | } 48 | 49 | @interface AFNetworkActivityIndicatorManager () 50 | @property (readwrite, nonatomic, assign) NSInteger activityCount; 51 | @property (readwrite, nonatomic, strong) NSTimer *activityIndicatorVisibilityTimer; 52 | @property (readonly, nonatomic, getter = isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; 53 | 54 | - (void)updateNetworkActivityIndicatorVisibility; 55 | - (void)updateNetworkActivityIndicatorVisibilityDelayed; 56 | @end 57 | 58 | @implementation AFNetworkActivityIndicatorManager 59 | @dynamic networkActivityIndicatorVisible; 60 | 61 | + (instancetype)sharedManager { 62 | static AFNetworkActivityIndicatorManager *_sharedManager = nil; 63 | static dispatch_once_t oncePredicate; 64 | dispatch_once(&oncePredicate, ^{ 65 | _sharedManager = [[self alloc] init]; 66 | }); 67 | 68 | return _sharedManager; 69 | } 70 | 71 | + (NSSet *)keyPathsForValuesAffectingIsNetworkActivityIndicatorVisible { 72 | return [NSSet setWithObject:@"activityCount"]; 73 | } 74 | 75 | - (id)init { 76 | self = [super init]; 77 | if (!self) { 78 | return nil; 79 | } 80 | 81 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidStart:) name:AFNetworkingOperationDidStartNotification object:nil]; 82 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingOperationDidFinishNotification object:nil]; 83 | 84 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 85 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidStart:) name:AFNetworkingTaskDidResumeNotification object:nil]; 86 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidSuspendNotification object:nil]; 87 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidCompleteNotification object:nil]; 88 | #endif 89 | 90 | return self; 91 | } 92 | 93 | - (void)dealloc { 94 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 95 | 96 | [_activityIndicatorVisibilityTimer invalidate]; 97 | } 98 | 99 | - (void)updateNetworkActivityIndicatorVisibilityDelayed { 100 | if (self.enabled) { 101 | // Delay hiding of activity indicator for a short interval, to avoid flickering 102 | if (![self isNetworkActivityIndicatorVisible]) { 103 | [self.activityIndicatorVisibilityTimer invalidate]; 104 | self.activityIndicatorVisibilityTimer = [NSTimer timerWithTimeInterval:kAFNetworkActivityIndicatorInvisibilityDelay target:self selector:@selector(updateNetworkActivityIndicatorVisibility) userInfo:nil repeats:NO]; 105 | [[NSRunLoop mainRunLoop] addTimer:self.activityIndicatorVisibilityTimer forMode:NSRunLoopCommonModes]; 106 | } else { 107 | [self performSelectorOnMainThread:@selector(updateNetworkActivityIndicatorVisibility) withObject:nil waitUntilDone:NO modes:@[NSRunLoopCommonModes]]; 108 | } 109 | } 110 | } 111 | 112 | - (BOOL)isNetworkActivityIndicatorVisible { 113 | return self.activityCount > 0; 114 | } 115 | 116 | - (void)updateNetworkActivityIndicatorVisibility { 117 | [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:[self isNetworkActivityIndicatorVisible]]; 118 | } 119 | 120 | - (void)setActivityCount:(NSInteger)activityCount { 121 | @synchronized(self) { 122 | _activityCount = activityCount; 123 | } 124 | 125 | dispatch_async(dispatch_get_main_queue(), ^{ 126 | [self updateNetworkActivityIndicatorVisibilityDelayed]; 127 | }); 128 | } 129 | 130 | - (void)incrementActivityCount { 131 | [self willChangeValueForKey:@"activityCount"]; 132 | @synchronized(self) { 133 | _activityCount++; 134 | } 135 | [self didChangeValueForKey:@"activityCount"]; 136 | 137 | dispatch_async(dispatch_get_main_queue(), ^{ 138 | [self updateNetworkActivityIndicatorVisibilityDelayed]; 139 | }); 140 | } 141 | 142 | - (void)decrementActivityCount { 143 | [self willChangeValueForKey:@"activityCount"]; 144 | @synchronized(self) { 145 | #pragma clang diagnostic push 146 | #pragma clang diagnostic ignored "-Wgnu" 147 | _activityCount = MAX(_activityCount - 1, 0); 148 | #pragma clang diagnostic pop 149 | } 150 | [self didChangeValueForKey:@"activityCount"]; 151 | 152 | dispatch_async(dispatch_get_main_queue(), ^{ 153 | [self updateNetworkActivityIndicatorVisibilityDelayed]; 154 | }); 155 | } 156 | 157 | - (void)networkRequestDidStart:(NSNotification *)notification { 158 | if ([AFNetworkRequestFromNotification(notification) URL]) { 159 | [self incrementActivityCount]; 160 | } 161 | } 162 | 163 | - (void)networkRequestDidFinish:(NSNotification *)notification { 164 | if ([AFNetworkRequestFromNotification(notification) URL]) { 165 | [self decrementActivityCount]; 166 | } 167 | } 168 | 169 | @end 170 | 171 | #endif 172 | -------------------------------------------------------------------------------- /Pods/FMDB/src/fmdb/FMDatabaseQueue.m: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabaseQueue.m 3 | // fmdb 4 | // 5 | // Created by August Mueller on 6/22/11. 6 | // Copyright 2011 Flying Meat Inc. All rights reserved. 7 | // 8 | 9 | #import "FMDatabaseQueue.h" 10 | #import "FMDatabase.h" 11 | 12 | /* 13 | 14 | Note: we call [self retain]; before using dispatch_sync, just incase 15 | FMDatabaseQueue is released on another thread and we're in the middle of doing 16 | something in dispatch_sync 17 | 18 | */ 19 | 20 | /* 21 | * A key used to associate the FMDatabaseQueue object with the dispatch_queue_t it uses. 22 | * This in turn is used for deadlock detection by seeing if inDatabase: is called on 23 | * the queue's dispatch queue, which should not happen and causes a deadlock. 24 | */ 25 | static const void * const kDispatchQueueSpecificKey = &kDispatchQueueSpecificKey; 26 | 27 | @implementation FMDatabaseQueue 28 | 29 | @synthesize path = _path; 30 | @synthesize openFlags = _openFlags; 31 | 32 | + (instancetype)databaseQueueWithPath:(NSString*)aPath { 33 | 34 | FMDatabaseQueue *q = [[self alloc] initWithPath:aPath]; 35 | 36 | FMDBAutorelease(q); 37 | 38 | return q; 39 | } 40 | 41 | + (instancetype)databaseQueueWithPath:(NSString*)aPath flags:(int)openFlags { 42 | 43 | FMDatabaseQueue *q = [[self alloc] initWithPath:aPath flags:openFlags]; 44 | 45 | FMDBAutorelease(q); 46 | 47 | return q; 48 | } 49 | 50 | + (Class)databaseClass { 51 | return [FMDatabase class]; 52 | } 53 | 54 | - (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags { 55 | 56 | self = [super init]; 57 | 58 | if (self != nil) { 59 | 60 | _db = [[[self class] databaseClass] databaseWithPath:aPath]; 61 | FMDBRetain(_db); 62 | 63 | #if SQLITE_VERSION_NUMBER >= 3005000 64 | BOOL success = [_db openWithFlags:openFlags]; 65 | #else 66 | BOOL success = [_db open]; 67 | #endif 68 | if (!success) { 69 | NSLog(@"Could not create database queue for path %@", aPath); 70 | FMDBRelease(self); 71 | return 0x00; 72 | } 73 | 74 | _path = FMDBReturnRetained(aPath); 75 | 76 | _queue = dispatch_queue_create([[NSString stringWithFormat:@"fmdb.%@", self] UTF8String], NULL); 77 | dispatch_queue_set_specific(_queue, kDispatchQueueSpecificKey, (__bridge void *)self, NULL); 78 | _openFlags = openFlags; 79 | } 80 | 81 | return self; 82 | } 83 | 84 | - (instancetype)initWithPath:(NSString*)aPath { 85 | 86 | // default flags for sqlite3_open 87 | return [self initWithPath:aPath flags:SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE]; 88 | } 89 | 90 | - (instancetype)init { 91 | return [self initWithPath:nil]; 92 | } 93 | 94 | 95 | - (void)dealloc { 96 | 97 | FMDBRelease(_db); 98 | FMDBRelease(_path); 99 | 100 | if (_queue) { 101 | FMDBDispatchQueueRelease(_queue); 102 | _queue = 0x00; 103 | } 104 | #if ! __has_feature(objc_arc) 105 | [super dealloc]; 106 | #endif 107 | } 108 | 109 | - (void)close { 110 | FMDBRetain(self); 111 | dispatch_sync(_queue, ^() { 112 | [_db close]; 113 | FMDBRelease(_db); 114 | _db = 0x00; 115 | }); 116 | FMDBRelease(self); 117 | } 118 | 119 | - (FMDatabase*)database { 120 | if (!_db) { 121 | _db = FMDBReturnRetained([FMDatabase databaseWithPath:_path]); 122 | 123 | #if SQLITE_VERSION_NUMBER >= 3005000 124 | BOOL success = [_db openWithFlags:_openFlags]; 125 | #else 126 | BOOL success = [db open]; 127 | #endif 128 | if (!success) { 129 | NSLog(@"FMDatabaseQueue could not reopen database for path %@", _path); 130 | FMDBRelease(_db); 131 | _db = 0x00; 132 | return 0x00; 133 | } 134 | } 135 | 136 | return _db; 137 | } 138 | 139 | - (void)inDatabase:(void (^)(FMDatabase *db))block { 140 | /* Get the currently executing queue (which should probably be nil, but in theory could be another DB queue 141 | * and then check it against self to make sure we're not about to deadlock. */ 142 | FMDatabaseQueue *currentSyncQueue = (__bridge id)dispatch_get_specific(kDispatchQueueSpecificKey); 143 | assert(currentSyncQueue != self && "inDatabase: was called reentrantly on the same queue, which would lead to a deadlock"); 144 | 145 | FMDBRetain(self); 146 | 147 | dispatch_sync(_queue, ^() { 148 | 149 | FMDatabase *db = [self database]; 150 | block(db); 151 | 152 | if ([db hasOpenResultSets]) { 153 | NSLog(@"Warning: there is at least one open result set around after performing [FMDatabaseQueue inDatabase:]"); 154 | 155 | #ifdef DEBUG 156 | NSSet *openSetCopy = FMDBReturnAutoreleased([[db valueForKey:@"_openResultSets"] copy]); 157 | for (NSValue *rsInWrappedInATastyValueMeal in openSetCopy) { 158 | FMResultSet *rs = (FMResultSet *)[rsInWrappedInATastyValueMeal pointerValue]; 159 | NSLog(@"query: '%@'", [rs query]); 160 | } 161 | #endif 162 | } 163 | }); 164 | 165 | FMDBRelease(self); 166 | } 167 | 168 | 169 | - (void)beginTransaction:(BOOL)useDeferred withBlock:(void (^)(FMDatabase *db, BOOL *rollback))block { 170 | FMDBRetain(self); 171 | dispatch_sync(_queue, ^() { 172 | 173 | BOOL shouldRollback = NO; 174 | 175 | if (useDeferred) { 176 | [[self database] beginDeferredTransaction]; 177 | } 178 | else { 179 | [[self database] beginTransaction]; 180 | } 181 | 182 | block([self database], &shouldRollback); 183 | 184 | if (shouldRollback) { 185 | [[self database] rollback]; 186 | } 187 | else { 188 | [[self database] commit]; 189 | } 190 | }); 191 | 192 | FMDBRelease(self); 193 | } 194 | 195 | - (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block { 196 | [self beginTransaction:YES withBlock:block]; 197 | } 198 | 199 | - (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block { 200 | [self beginTransaction:NO withBlock:block]; 201 | } 202 | 203 | #if SQLITE_VERSION_NUMBER >= 3007000 204 | - (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block { 205 | 206 | static unsigned long savePointIdx = 0; 207 | __block NSError *err = 0x00; 208 | FMDBRetain(self); 209 | dispatch_sync(_queue, ^() { 210 | 211 | NSString *name = [NSString stringWithFormat:@"savePoint%ld", savePointIdx++]; 212 | 213 | BOOL shouldRollback = NO; 214 | 215 | if ([[self database] startSavePointWithName:name error:&err]) { 216 | 217 | block([self database], &shouldRollback); 218 | 219 | if (shouldRollback) { 220 | // We need to rollback and release this savepoint to remove it 221 | [[self database] rollbackToSavePointWithName:name error:&err]; 222 | } 223 | [[self database] releaseSavePointWithName:name error:&err]; 224 | 225 | } 226 | }); 227 | FMDBRelease(self); 228 | return err; 229 | } 230 | #endif 231 | 232 | @end 233 | -------------------------------------------------------------------------------- /Pods/FMDB/src/fmdb/FMDatabaseAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabaseAdditions.m 3 | // fmdb 4 | // 5 | // Created by August Mueller on 10/30/05. 6 | // Copyright 2005 Flying Meat Inc.. All rights reserved. 7 | // 8 | 9 | #import "FMDatabase.h" 10 | #import "FMDatabaseAdditions.h" 11 | #import "TargetConditionals.h" 12 | 13 | @interface FMDatabase (PrivateStuff) 14 | - (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray*)arrayArgs orDictionary:(NSDictionary *)dictionaryArgs orVAList:(va_list)args; 15 | @end 16 | 17 | @implementation FMDatabase (FMDatabaseAdditions) 18 | 19 | #define RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(type, sel) \ 20 | va_list args; \ 21 | va_start(args, query); \ 22 | FMResultSet *resultSet = [self executeQuery:query withArgumentsInArray:0x00 orDictionary:0x00 orVAList:args]; \ 23 | va_end(args); \ 24 | if (![resultSet next]) { return (type)0; } \ 25 | type ret = [resultSet sel:0]; \ 26 | [resultSet close]; \ 27 | [resultSet setParentDB:nil]; \ 28 | return ret; 29 | 30 | 31 | - (NSString*)stringForQuery:(NSString*)query, ... { 32 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSString *, stringForColumnIndex); 33 | } 34 | 35 | - (int)intForQuery:(NSString*)query, ... { 36 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(int, intForColumnIndex); 37 | } 38 | 39 | - (long)longForQuery:(NSString*)query, ... { 40 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(long, longForColumnIndex); 41 | } 42 | 43 | - (BOOL)boolForQuery:(NSString*)query, ... { 44 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(BOOL, boolForColumnIndex); 45 | } 46 | 47 | - (double)doubleForQuery:(NSString*)query, ... { 48 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(double, doubleForColumnIndex); 49 | } 50 | 51 | - (NSData*)dataForQuery:(NSString*)query, ... { 52 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSData *, dataForColumnIndex); 53 | } 54 | 55 | - (NSDate*)dateForQuery:(NSString*)query, ... { 56 | RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSDate *, dateForColumnIndex); 57 | } 58 | 59 | 60 | - (BOOL)tableExists:(NSString*)tableName { 61 | 62 | tableName = [tableName lowercaseString]; 63 | 64 | FMResultSet *rs = [self executeQuery:@"select [sql] from sqlite_master where [type] = 'table' and lower(name) = ?", tableName]; 65 | 66 | //if at least one next exists, table exists 67 | BOOL returnBool = [rs next]; 68 | 69 | //close and free object 70 | [rs close]; 71 | 72 | return returnBool; 73 | } 74 | 75 | /* 76 | get table with list of tables: result colums: type[STRING], name[STRING],tbl_name[STRING],rootpage[INTEGER],sql[STRING] 77 | check if table exist in database (patch from OZLB) 78 | */ 79 | - (FMResultSet*)getSchema { 80 | 81 | //result colums: type[STRING], name[STRING],tbl_name[STRING],rootpage[INTEGER],sql[STRING] 82 | FMResultSet *rs = [self executeQuery:@"SELECT type, name, tbl_name, rootpage, sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type != 'meta' AND name NOT LIKE 'sqlite_%' ORDER BY tbl_name, type DESC, name"]; 83 | 84 | return rs; 85 | } 86 | 87 | /* 88 | get table schema: result colums: cid[INTEGER], name,type [STRING], notnull[INTEGER], dflt_value[],pk[INTEGER] 89 | */ 90 | - (FMResultSet*)getTableSchema:(NSString*)tableName { 91 | 92 | //result colums: cid[INTEGER], name,type [STRING], notnull[INTEGER], dflt_value[],pk[INTEGER] 93 | FMResultSet *rs = [self executeQuery:[NSString stringWithFormat: @"pragma table_info('%@')", tableName]]; 94 | 95 | return rs; 96 | } 97 | 98 | - (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName { 99 | 100 | BOOL returnBool = NO; 101 | 102 | tableName = [tableName lowercaseString]; 103 | columnName = [columnName lowercaseString]; 104 | 105 | FMResultSet *rs = [self getTableSchema:tableName]; 106 | 107 | //check if column is present in table schema 108 | while ([rs next]) { 109 | if ([[[rs stringForColumn:@"name"] lowercaseString] isEqualToString:columnName]) { 110 | returnBool = YES; 111 | break; 112 | } 113 | } 114 | 115 | //If this is not done FMDatabase instance stays out of pool 116 | [rs close]; 117 | 118 | return returnBool; 119 | } 120 | 121 | 122 | #if SQLITE_VERSION_NUMBER >= 3007017 123 | 124 | - (uint32_t)applicationID { 125 | 126 | uint32_t r = 0; 127 | 128 | FMResultSet *rs = [self executeQuery:@"pragma application_id"]; 129 | 130 | if ([rs next]) { 131 | r = (uint32_t)[rs longLongIntForColumnIndex:0]; 132 | } 133 | 134 | [rs close]; 135 | 136 | return r; 137 | } 138 | 139 | - (void)setApplicationID:(uint32_t)appID { 140 | NSString *query = [NSString stringWithFormat:@"pragma application_id=%d", appID]; 141 | FMResultSet *rs = [self executeQuery:query]; 142 | [rs next]; 143 | [rs close]; 144 | } 145 | 146 | 147 | #if TARGET_OS_MAC && !TARGET_OS_IPHONE 148 | - (NSString*)applicationIDString { 149 | NSString *s = NSFileTypeForHFSTypeCode([self applicationID]); 150 | 151 | assert([s length] == 6); 152 | 153 | s = [s substringWithRange:NSMakeRange(1, 4)]; 154 | 155 | 156 | return s; 157 | 158 | } 159 | 160 | - (void)setApplicationIDString:(NSString*)s { 161 | 162 | if ([s length] != 4) { 163 | NSLog(@"setApplicationIDString: string passed is not exactly 4 chars long. (was %ld)", [s length]); 164 | } 165 | 166 | [self setApplicationID:NSHFSTypeCodeFromFileType([NSString stringWithFormat:@"'%@'", s])]; 167 | } 168 | 169 | 170 | #endif 171 | 172 | #endif 173 | 174 | - (uint32_t)userVersion { 175 | uint32_t r = 0; 176 | 177 | FMResultSet *rs = [self executeQuery:@"pragma user_version"]; 178 | 179 | if ([rs next]) { 180 | r = (uint32_t)[rs longLongIntForColumnIndex:0]; 181 | } 182 | 183 | [rs close]; 184 | return r; 185 | } 186 | 187 | - (void)setUserVersion:(uint32_t)version { 188 | NSString *query = [NSString stringWithFormat:@"pragma user_version = %d", version]; 189 | FMResultSet *rs = [self executeQuery:query]; 190 | [rs next]; 191 | [rs close]; 192 | } 193 | 194 | #pragma clang diagnostic push 195 | #pragma clang diagnostic ignored "-Wdeprecated-implementations" 196 | 197 | - (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName __attribute__ ((deprecated)) { 198 | return [self columnExists:columnName inTableWithName:tableName]; 199 | } 200 | 201 | #pragma clang diagnostic pop 202 | 203 | 204 | - (BOOL)validateSQL:(NSString*)sql error:(NSError**)error { 205 | sqlite3_stmt *pStmt = NULL; 206 | BOOL validationSucceeded = YES; 207 | 208 | int rc = sqlite3_prepare_v2(_db, [sql UTF8String], -1, &pStmt, 0); 209 | if (rc != SQLITE_OK) { 210 | validationSucceeded = NO; 211 | if (error) { 212 | *error = [NSError errorWithDomain:NSCocoaErrorDomain 213 | code:[self lastErrorCode] 214 | userInfo:[NSDictionary dictionaryWithObject:[self lastErrorMessage] 215 | forKey:NSLocalizedDescriptionKey]]; 216 | } 217 | } 218 | 219 | sqlite3_finalize(pStmt); 220 | 221 | return validationSucceeded; 222 | } 223 | 224 | @end 225 | -------------------------------------------------------------------------------- /Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h: -------------------------------------------------------------------------------- 1 | // UIImageView+AFNetworking.h 2 | // 3 | // Copyright (c) 2013-2014 AFNetworking (http://afnetworking.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | #import 26 | 27 | #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) 28 | 29 | #import 30 | 31 | @protocol AFURLResponseSerialization, AFImageCache; 32 | 33 | /** 34 | This category adds methods to the UIKit framework's `UIImageView` class. The methods in this category provide support for loading remote images asynchronously from a URL. 35 | */ 36 | @interface UIImageView (AFNetworking) 37 | 38 | ///---------------------------- 39 | /// @name Accessing Image Cache 40 | ///---------------------------- 41 | 42 | /** 43 | The image cache used to improve image loadiing performance on scroll views. By default, this is an `NSCache` subclass conforming to the `AFImageCache` protocol, which listens for notification warnings and evicts objects accordingly. 44 | */ 45 | + (id )sharedImageCache; 46 | 47 | /** 48 | Set the cache used for image loading. 49 | 50 | @param imageCache The image cache. 51 | */ 52 | + (void)setSharedImageCache:(id )imageCache; 53 | 54 | ///------------------------------------ 55 | /// @name Accessing Response Serializer 56 | ///------------------------------------ 57 | 58 | /** 59 | The response serializer used to create an image representation from the server response and response data. By default, this is an instance of `AFImageResponseSerializer`. 60 | 61 | @discussion Subclasses of `AFImageResponseSerializer` could be used to perform post-processing, such as color correction, face detection, or other effects. See https://github.com/AFNetworking/AFCoreImageSerializer 62 | */ 63 | @property (nonatomic, strong) id imageResponseSerializer; 64 | 65 | ///-------------------- 66 | /// @name Setting Image 67 | ///-------------------- 68 | 69 | /** 70 | Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. 71 | 72 | If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. 73 | 74 | By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:` 75 | 76 | @param url The URL used for the image request. 77 | */ 78 | - (void)setImageWithURL:(NSURL *)url; 79 | 80 | /** 81 | Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. 82 | 83 | If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. 84 | 85 | By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:` 86 | 87 | @param url The URL used for the image request. 88 | @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes. 89 | */ 90 | - (void)setImageWithURL:(NSURL *)url 91 | placeholderImage:(UIImage *)placeholderImage; 92 | 93 | /** 94 | Asynchronously downloads an image from the specified URL request, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. 95 | 96 | If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. 97 | 98 | If a success block is specified, it is the responsibility of the block to set the image of the image view before returning. If no success block is specified, the default behavior of setting the image with `self.image = image` is applied. 99 | 100 | @param urlRequest The URL request used for the image request. 101 | @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes. 102 | @param success A block to be executed when the image request operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the request and response parameters will be `nil`. 103 | @param failure A block object to be executed when the image request operation finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. 104 | */ 105 | - (void)setImageWithURLRequest:(NSURLRequest *)urlRequest 106 | placeholderImage:(UIImage *)placeholderImage 107 | success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success 108 | failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure; 109 | 110 | /** 111 | Cancels any executing image operation for the receiver, if one exists. 112 | */ 113 | - (void)cancelImageRequestOperation; 114 | 115 | @end 116 | 117 | #pragma mark - 118 | 119 | /** 120 | The `AFImageCache` protocol is adopted by an object used to cache images loaded by the AFNetworking category on `UIImageView`. 121 | */ 122 | @protocol AFImageCache 123 | 124 | /** 125 | Returns a cached image for the specififed request, if available. 126 | 127 | @param request The image request. 128 | 129 | @return The cached image. 130 | */ 131 | - (UIImage *)cachedImageForRequest:(NSURLRequest *)request; 132 | 133 | /** 134 | Caches a particular image for the specified request. 135 | 136 | @param image The image to cache. 137 | @param request The request to be used as a cache key. 138 | */ 139 | - (void)cacheImage:(UIImage *)image 140 | forRequest:(NSURLRequest *)request; 141 | @end 142 | 143 | #endif 144 | --------------------------------------------------------------------------------