小编Par*_*ker的帖子

如何在特定时间内快速修剪视频

我正在处理一项任务,我必须将录制的视频从特定的起始点修剪为用户输入或选择的特定终点.我该怎么做呢 正如我UIVideoEditorController之前使用的,但我不想使用默认视图,我想直接修剪视频.

let FinalUrlTosave = NSURL(string: "\(newURL)")
    exportSession!.outputURL=FinalUrlTosave
    exportSession!.shouldOptimizeForNetworkUse = true
    // exportSession.outputFileType = AVFileTypeQuickTimeMovie
    exportSession!.outputFileType = AVFileTypeQuickTimeMovie;
    let start:CMTime
    let duration:CMTime
    var st = starttime.doubleValue
    var ed = endTime.doubleValue
    start = CMTimeMakeWithSeconds(st, 600)
    duration = CMTimeMakeWithSeconds(ed, 600)
    // let timeRangeForCurrentSlice = CMTimeRangeMake(start, duration)
    let range = CMTimeRangeMake(start, duration);
    exportSession!.timeRange = range

       exportSession!.exportAsynchronouslyWithCompletionHandler({
        switch exportSession!.status{
        case  AVAssetExportSessionStatus.Failed:

            print("failed \(exportSession!.error)")
        case AVAssetExportSessionStatus.Cancelled:
            print("cancelled \(exportSession!.error)")
        default:
            print("complete....complete")
            //                self.SaveVideoToPhotoLibrary(destinationURL1!)

        }
    })
Run Code Online (Sandbox Code Playgroud)

我试图用这个来实现我的目标,但没有成功.

错误信息:

failed可选(错误域= NSURLErrorDomain代码= -1100"在此服务器上找不到请求的URL."UserInfo = {NSErrorFailingURLStringKey = file:/// …

trim ios avassetexportsession uivideoeditorcontroller swift

10
推荐指数
2
解决办法
8223
查看次数

如何从沙盒切换为直播应用内购买

我正在使用In App Purchase,当我从沙盒帐户进行测试时,它工作正常。但是,当我尝试通过真实账户将金额设为零来购买在线订阅时。它给出了一个错误消息:[您目前无权在沙箱中的此inApp中进行购买(环境沙箱)]

我想这是在沙盒模式下设置的。因此,正如我在沙盒中测试的那样,它可以很好地工作,我可以让所有人都能买到它吗?错误画面截图

iphone in-app-purchase ios

3
推荐指数
1
解决办法
1991
查看次数

Apple Pay付款证书不受信任

我正在努力在ios应用程序中实现Apple Pay,为此,我尝试在Apple帐户上创建证书。

我遵循了这个setting_up_apple_pay_requirements链接。

并遵循以下三个步骤

1.)创建商家ID。

2.)创建付款处理证书。

3.)在Xcode中启用Apple Pay。

但是在我添加创建的证书的钥匙串中,它显示“ Apple Pay付款处理:“ merchent id”证书不受信任”

提前致谢

certificate ios applepay

3
推荐指数
1
解决办法
1077
查看次数

协议可选方法在未实现时会崩溃

我正在使用带有一些可选方法的协议

#import <UIKit/UIKit.h>
@class TextViewTableViewCell;

@protocol TextViewTableViewCellDelegate

@optional
- (void)textViewDidChange:(UITextView *)textView forIndexPath:(NSIndexPath *)indexPath;
- (void)textViewTableViewCellDoneTyping:(UITextView *)textView forIndexPath:(NSIndexPath *)indexPath;
- (BOOL)shouldChangeEditTextCellText:(TextViewTableViewCell *)cell newText:(NSString *)newText;

@end

@interface TextViewTableViewCell : UITableViewCell <UITextViewDelegate>
Run Code Online (Sandbox Code Playgroud)

但如果我使用我实现此协议的类中的任何函数,它就会崩溃

我不知道为什么会发生这种情况。据我所知,可选方法并不是强制使用的。

当调用委托函数并且我们调用协议方法时,它会导致该方法崩溃

- (void)textViewDidChange:(UITextView *)textView
{
[self.delegate textViewDidChange:self.textView forIndexPath:self.indexPath];
}
Run Code Online (Sandbox Code Playgroud)

protocols objective-c ios

1
推荐指数
1
解决办法
416
查看次数