星期日, 2月 19, 2017

[Objective-C] 快快樂樂使用 facebook SDK

第一次整合facebook SDK登入、上傳照片/影片測試

踩雷

要做http連線要記得開權限

http://blog.changyy.org/2015/10/ios-ios9-app-transport-security.html

傳360相片無效


任何一张全景照片按Facebook说明Editing 360 Photos & Injecting Metadata添加全景标识ProjectionType="equirectangular"

http://www.jianshu.com/p/f71d06f67899

權限

As i seen you code that you are trying to use the "user_likes", "user_birthday", "public_profile" and "publish_actions" permissions.
From 1st May 2015 facebook has only enabled "public_profile", "email" and "user_friends" are available without the approval process.
For "user_likes", "user_birthday" and "publish_actions" you need to get approval from the facebook.
爆炸resposne


文件

上手指南
https://developers.facebook.com/docs/ios/getting-started/#download
上傳圖片
https://developers.facebook.com/docs/graph-api/reference/photo/
https://developers.facebook.com/docs/graph-api/photo-uploads

//上傳影片
https://developers.facebook.com/docs/graph-api/video-uploads
//直播
https://developers.facebook.com/docs/videos/live-video

http://stackoverflow.com/questions/30317934/post-image-on-facebook-using-fbsdk-4-x-for-ios

星期四, 2月 16, 2017

[objective c] 自幹上傳 mutipart/form 到youtube

要測試一下上傳影片到youtube
由於先前有在java自幹過一次 mutipart/form(四年前了@@) ,
這次改用objective c,順道記錄一下。

Youtube Upload API

函式庫


沒用什麼第三方的庫,NSURLSession自幹

NSURLSessionConfiguration : 做授權

NSMutableURLRequest : 做連線

NSURLSessionUploadTask : 上傳的任務

基本上參考這篇就會寫了
NSURLSessionUploadTask(上传任务)

星期三, 1月 18, 2017

[Objective-c] iOS 基本技能: 呼叫相機

超常用的iOS呼叫相機基本技能,測試完記錄一下。

使用UIImagePickerController (簡單、快速)

- (void) initCamera{
    
    NSLog(@"initCamera");
    dispatch_async(dispatch_get_main_queue(), ^{
        UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
        
        //檢查是否支援此Source Type(相機)
        if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
            NSLog(@"Access Camera Device");
            
            //設定影像來源為相機
            imagePicker.sourceTypeUIImagePickerControllerSourceTypeCamera;
            imagePicker.delegate = self;
            imagePicker.allowsEditing = YES;
            
            //顯示UIImagePickerController
            [self presentViewController:imagePicker animated:YES completion:nil];
        }
        else {
            //提示使用者,目前設備不支援相機
            NSLog(@"No Camera Device");
        }

    });
    
}

//使用者按下確定時
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    //取得剛拍攝的相片(或是由相簿中所選擇的相片)
    UIImage *image=[info objectForKey:UIImagePickerControllerEditedImage];
    
    //設定ImageViewImage物件,例如:
    //yourImageView.image = image;
    
    [picker dismissViewControllerAnimated:YES completion:^{}];
}

//使用者按下取消時
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
    //一般情況下沒有什麼特別要做的事情
    
    [picker dismissViewControllerAnimated:YES completion:^{}];

}


使用AV Foundation

優點就是彈性比較大,速度快

[Objective-C] 初試一下 youtube live streaming (二) 實作步驟

找到幾篇有關於直播的教學,但都2014了,還是可以參考一下。
以下簡述使用Youtube直播步驟



http://yhsiang.logdown.com/posts/2014/04/16/stream-to-youtube-with-live-streaming-api

https://youtube-eng.googleblog.com/2014/10/watchme-live-stream.html

http://justinyang1221.blogspot.tw/2014/10/live-stream-youtubestreaming-to-youtube.html

將即時串流推送到串流伺服器 (推流)
https://github.com/jgh-/VideoCore
https://github.com/LaiFengiOS/LFLiveKit => 最好操作整合,很多人拿來二次開發
https://github.com/pili-engineering/PLMediaStreamingKit

顯示即時串流 (拉流)
https://github.com/Bilibili/ijkplayer

星期六, 1月 14, 2017

[ubuntu] 搞壞了sudo...must be owned by uid 0 and have the setuid bit set


sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

XD不小心下錯了chown的指令,然後sudo就爆了。
搞了一小時還是沒弄好機器,
還是重裝VM的存檔-,,-
有招一日再來研究研究

http://ithelp.ithome.com.tw/articles/10053821
https://my.oschina.net/cxz001/blog/297404
http://unix.stackexchange.com/questions/16962/how-to-get-back-sudo-on-ubuntu

其他你感興趣的文章

Related Posts with Thumbnails