代碼託管: http://git.oschina.net/
工作區(file) -> 暫存區(本地版本庫) -> 分支(本地版本庫) -> 遠程推送
原理圖:
file文件添加到暫存區, 暫存區提交到分支, 然後拉去遠程推送的內容, 代碼合併, 運行, 如果無問題則進行遠程推送, 如果有錯需要修改則從添加重新走一遍流程, soga!
遠程推送會進行覆蓋
讓工程項目中顯示生成的Xcode自帶的git文件:
終端命令: 顯示:defaults write com.apple.finder AppleShowAllFiles -bool true
隱藏:defaults write com.apple.finder AppleShowAllFiles -bool false
遠程推送.原理圖
APNS: 是蘋果服務器
token: 是存在蘋果服務器的唯一app標示
服務器: 本地服務器
描述:
APP在iOS註冊, APNS向APP發送一個Token,
APP將得到的Token存在本機的服務器中, 當需要發送遠程推送時, 有本地服務器發送 目標Token+內容 向APNS, 然後APNS想APP發送通知
信鴿推送: xg.qq.com
下載信鴿SDK, 選擇Xg-Push-SDK-iOS-2.4.5 -> demo -> sdk -> 拖入工程
引入框架: Security.framework, libsqlite3.tbd, CoreTelephony.framework, SystemConfiguration.framew, libz.tbd, CFnetwork.framework六個框架
AppDelegate.m中引用XGPush.h頭文件
// 註冊失敗返回error
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
NSLog(@"error ===== %@", error);
}
// 5. 發送通知返回通知內容
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
NSLog(@"userInfo ===== %@", userInfo);
}
// 2. 註冊成功APNS返回Token
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// 3. 將獲得的Token發送給自己的服務器
[XGPush registerDevice:deviceToken];
NSLog(@"Token ===== %@", [deviceToken description]);
}
ViewController.m中引用XGPush.h文件
// 1. 註冊
// 系統判斷
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0f) {
// 系統iOS8.0以上使用
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeSound | UIUserNotificationTypeBadge | UIUserNotificationTypeAlert categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
} else {
// 系統iOS8.0以下使用
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];
}
[XGPush startApp:2200165512 appKey:@"IBS726V61PQP"];