Commit 3c1a8678 by houweibin

1,first commit

parent f70ff179
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
# use_frameworks!
target 'iCemarose' do
# CordovaLib Dependency Pod
#pod 'Cordova'
pod 'AFNetworking','~> 2.6'
pod 'JSONModel','~> 1.2.0'
pod 'SDWebImage','~> 3.7.1'
pod 'SAMCategories', '~> 0.5.1'
pod 'SAMTextView', '~> 0.2.1'
pod 'SAMTextField', '~> 0.1.1'
pod 'PSAlertView', '1.1'
pod 'MBProgressHUD', '~> 0.8'
pod 'HMSegmentedControl@hons82', '~> 1.3.1'
pod 'MZFormSheetPresentationController'
pod 'MJRefresh', '~> 3.1'
pod 'AFNetworkActivityLogger'
pod 'SFFocusViewLayout', '~> 2.0'
pod 'YYWebImage'
pod 'MagicalRecord','~> 2.2'
pod 'Mobile-Buy-SDK',:git => 'https://github.com/houweibin/mobile-buy-sdk-ios'
end
#NewCemarose
#iCemarose
This source diff could not be displayed because it is too large. You can view the blob instead.
//
// AppDelegate.h
// iToYoung
//
// Created by Yaotian on 5/13/16.
// Copyright © 2016 Kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "WXApi.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate,WXApiDelegate>
@property (strong, nonatomic) UIWindow *window;
- (void)toMain;
- (void)toLogin;
- (void)toGuide;
@end
//
// AppDelegate.m
// iToYoung
//
// Created by Yaotian on 5/13/16.
// Copyright © 2016 Kollway. All rights reserved.
//
#import "AppDelegate.h"
#import "UIColor+SAMAdditions.h"
#import "KWMImageUtil.h"
#import "KWMUserDao.h"
#import "KWMUser.h"
#import "KWMStringUtil.h"
#import "KWMGuideVC.h"
#import "KWMLoginVC.h"
#import "KWMUserModel.h"
@interface AppDelegate ()
@property (nonatomic) id customPushObserver;
@property (nonatomic) BOOL isFirst;//是否第一次进入
@end
@implementation AppDelegate{
BOOL enterBackground;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[NSThread sleepForTimeInterval:1];
[_window makeKeyAndVisible];
//UI: Appearance
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
[[UINavigationBar appearance] setTintColor:[UIColor sam_colorWithHex:@"333333"]];
[[UINavigationBar appearance] setTitleTextAttributes:@{
NSForegroundColorAttributeName: [UIColor sam_colorWithHex:@"333333"],
NSFontAttributeName: [UIFont systemFontOfSize:18.0f]}];
//去掉navigationbar底部的黑线
[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
[[UINavigationBar appearance] setBackgroundImage:[KWMImageUtil createColorImage:[UIColor sam_colorWithHex:@"FFFFFF"]] forBarMetrics:UIBarMetricsDefault];
//navigationbar樣式
[[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTranslucent:NO];
//改变所有输入框的光标颜色
[[UITextField appearance] setTintColor:[UIColor sam_colorWithHex:@"F1929A"]];
//去掉返回按钮的文字
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-UI_SCREEN_WIDTH, -UI_SCREEN_HEITHT) forBarMetrics:UIBarMetricsDefault];
//修改系统的backbutton的图片
[UINavigationBar appearance].backIndicatorTransitionMaskImage = [UIImage imageNamed:@"btn_nav_back"];
[UINavigationBar appearance].backIndicatorImage = [UIImage imageNamed:@"btn_nav_back"];
[UINavigationBar appearance].shadowImage = [UIImage new];
// CoreData 初始化
[MagicalRecord setupCoreDataStackWithStoreNamed:@"DB_shopCart"];
// [self cleanAndResetupDB];
BOOL isProduction = YES;
#ifdef DEBUG
isProduction = NO;
#endif
//首页还是引导页
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"firstTime"]) {
[self toGuide];
}else{
[self toMain];
}
[WXApi registerApp:WechatAppKey];
return YES;
}
//去到引导界面
- (void)toGuide{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Guide" bundle:nil];
UIViewController *guideVC = [storyboard instantiateViewControllerWithIdentifier:@"KWMGuideVC"];
self.window.rootViewController = guideVC;
[self.window makeKeyAndVisible];
}
//去到主界面
- (void)toMain{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *mainVC = [storyboard instantiateViewControllerWithIdentifier:@"KWMMainVC"];
self.window.rootViewController = mainVC;
[self.window makeKeyAndVisible];
}
//去到登录界面
- (void)toLogin {
// UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
// UIViewController *mainVC = [storyboard instantiateViewControllerWithIdentifier:@"KWMMainVC"];
// self.window.rootViewController = mainVC;
// [self.window makeKeyAndVisible];
}
-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
return [WXApi handleOpenURL:url delegate:self];
}
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
return [WXApi handleOpenURL:url delegate:self];
}
#pragma mark -
#pragma mark WXApiDelegate 微信分享的相关回调
//onReq是微信终端向第三方程序发起请求,要求第三方程序响应。第三方程序响应完后必须调用sendRsp返回。在调用sendRsp返回时,会切回到微信终端程序界面。
- (void)onReq:(BaseReq *)req
{
}
//如果第三方程序向微信发送了sendReq的请求,那么onResp会被回调。sendReq请求调用后,会切到微信终端程序界面。
//enum WXErrCode {
// WXSuccess = 0, /**< 成功 */
// WXErrCodeCommon = -1, /**< 普通错误类型 */
// WXErrCodeUserCancel = -2, /**< 用户点击取消并返回 */
// WXErrCodeSentFail = -3, /**< 发送失败 */
// WXErrCodeAuthDeny = -4, /**< 授权失败 */
// WXErrCodeUnsupport = -5, /**< 微信不支持 */
//};
- (void)onResp:(BaseResp *)resp
{
if([resp isKindOfClass:[SendMessageToWXResp class]]) {
switch (resp.errCode) {
case WXSuccess:
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"成功" message:@"微信分享成功" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
break;
case WXErrCodeUserCancel:
break;
default:
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"失败" message:@"微信分享失败" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
break;
}
}
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
/// Required - 注册 DeviceToken
// [JPUSHService registerDeviceToken:deviceToken];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
// Required,For systems with less than or equal to iOS6
// [JPUSHService handleRemoteNotification:userInfo];
// [self handlePush:userInfo];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
// IOS 7 Support Required
// [JPUSHService handleRemoteNotification:userInfo];
// [self handlePush:userInfo];
completionHandler(UIBackgroundFetchResultNewData);
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
//Optional
NSLog(@"did Fail To Register For Remote Notifications With Error: %@", error);
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
enterBackground = YES;
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
//进入前台,延迟半秒之后算进入应用
[self performSelector:@selector(initViewStatus) withObject:nil afterDelay:0.5];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
//清除CoreData
[MagicalRecord cleanUp];
}
-(void)initViewStatus{
enterBackground = NO;
}
//清除重设置数据库
- (void)cleanAndResetupDB{
NSString *dbStore = @"DB_shopCart";
NSError *error1 = nil;
NSURL *storeURL = [NSPersistentStore MR_urlForStoreName:dbStore];
[MagicalRecord cleanUp];
if([[NSFileManager defaultManager] removeItemAtURL:storeURL error:&error1]){
//Core Data
[MagicalRecord setupCoreDataStackWithStoreNamed:@"DB_shopCart"];
}
else{
NSLog(@"An error has occurred while deleting %@", dbStore);
}
}
@end
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "appicon.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "appicon-1.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "appicon-2.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "appicon-3.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "appicon-4.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "appicon-5.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "appicon-6.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "appicon-7.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "appicon-8.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "appicon-9.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "appicon-10.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "appicon-11.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "appicon-12.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "appicon-13.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "appicon-14.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "appicon-15.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "appicon-16.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Number Pad_del@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Number Pad_del@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "brand_im_CARAMEL@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "brand_im_CARAMEL@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_ nav_search@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_ nav_search@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_ nav_shop cart@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_ nav_shop cart@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_login_captcha wrong_del@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_login_captcha wrong_del@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_more@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_more@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_nav_back@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_nav_back@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_shop cart_more@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_shop cart_more@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_tab_ brand@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_tab_ brand@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_tab_ brand_pre@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_tab_ brand_pre@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_tab_mine@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_tab_mine@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_tab_store@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_tab_store@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "btn_tab_store_pre@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "btn_tab_store_pre@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "bttn-size-nor@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "bttn-size-nor@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "bttn-size-sel@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "bttn-size-sel@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "bttn_tab_home_sel@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "bttn_tab_home_sel@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "button_ brand_pull-up@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "button_ brand_pull-up@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "button_brand_pull-down@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "button_brand_pull-down@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "button_close@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "button_close@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "button_mine_log out@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "button_mine_log out@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "button_mine_login@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "button_mine_login@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "button_mine_more@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "button_mine_more@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "button_myorder_pull-up@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "button_myorder_pull-up@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "button_order_deit@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "button_order_deit@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic-splash-coin1@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic-splash-coin1@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic-splash-coin2@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic-splash-coin2@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment