Code Monkey home page Code Monkey logo

douyin-ios-swift's Issues

代码内存泄漏

AVPlayerView -> respondWithDataForRequest -> UTTypeCreatePreferredIdentifierForTag -> Unmanaged

无法在真机上运行

会报下面的编译错误
Showing All Messages
"_swift_getFieldAt", referenced from:
HandyJSON.Metadata.Class._propertyDescriptionsAndStartPoint() -> ([HandyJSON.Property.Description], Swift.Int32?)? in libHandyJSON.a(Metadata.o)
HandyJSON.Metadata.Struct.propertyDescriptions() -> [HandyJSON.Property.Description]? in libHandyJSON.a(Metadata.o)
ld: symbol(s) not found for architecture arm64

PlayView的一些疑问

在项目里直接把PlayerView拿过来用的, 一开始都运作的很好, 点开过若干(十个以上)播放页面以后就黑了,以后点开播放都是黑屏了
业务流程是外面列表有播放器,进入内容页面有播放器,点击全屏播放还有播放器(可能三个都有播放过,请求的是同一地址)
urlSession:didCompleteWithError:显示error为nil, 正确存到了Cache中,
但PlayerItem显示State:Fail,其中Error信息如下:

Error Domain=AVFoundationErrorDomain Code=-11839 "无法解码" UserInfo={NSLocalizedDescription=无法解码, NSUnderlyingError=0x283ea4fc0 {Error Domain=NSOSStatusErrorDomain Code=-12913 "(null)"}, NSLocalizedRecoverySuggestion=停止其他所有对媒体解密的操作,然后再试一次。, NSLocalizedFailureReason=此媒体所需的解码器正忙。}

从一篇文章中找到了解决方案
在APP运行期间, 只要执行这个方法, 超过16次, 就会出现这个这个错误.
https://www.jianshu.com/p/d3566e950e91
可能顺便解决内存积存的问题?

编译失败

下载zip包后直接解压,然后打开Douyin.xcworkspace,开始编译

环境:

  • macOS 10.13.6
  • Xcode 10.0

wx20180926-103145 2x

上下刷视频刷的快的话,必crash

func respondWithDataForRequest(loadingRequest:AVAssetResourceLoadingRequest) -> Bool {
let mimeType = self.response?.mimeType ?? ""
let contentType = UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeType as CFString, nil)
loadingRequest.contentInformationRequest?.isByteRangeAccessSupported = true
loadingRequest.contentInformationRequest?.contentType = contentType?.takeRetainedValue() as String?
// 崩溃位置 ---
loadingRequest.contentInformationRequest?.contentLength = (self.response?.expectedContentLength)!

    var startOffset:Int64 = loadingRequest.dataRequest?.requestedOffset ?? 0
    if loadingRequest.dataRequest?.currentOffset != 0 {
        startOffset = loadingRequest.dataRequest?.currentOffset ?? 0
    }
    
    if Int64(data?.count ?? 0)  < startOffset {
        return false
    }
    
    let unreadBytes:Int64 = Int64(data?.count ?? 0) - (startOffset)
    let numberOfBytesToRespondWidth:Int64 = min(Int64(loadingRequest.dataRequest?.requestedLength ?? 0), unreadBytes)
    if let subdata = (data?.subdata(in: Int(startOffset)..<Int(startOffset + numberOfBytesToRespondWidth)))  {
        loadingRequest.dataRequest?.respond(with: subdata)
        let endOffset:Int64 = startOffset + Int64(loadingRequest.dataRequest?.requestedLength ?? 0)
        return Int64(data?.count ?? 0) >= endOffset
    }
    return false
}

iOS新手,@escaping 语法看蒙了

这样写我能理解

        VisitorRequest.saveOrFindVisitor(success: { data in
            let response = data as! VisitorResponse
            let visitor = response.data
            Visitor.write(visitor:visitor!)
        }, failure: { error in
            print ("注册访客用户失败")
        })

但是这样就

        VisitorRequest.saveOrFindVisitor(success: { data in
            let response = data as! VisitorResponse
            let visitor = response.data
            Visitor.write(visitor:visitor!)
        }) { error in
            print("注册访客用户失败")
        }

为何 { error in print("注册访客用户失败") } 是写在 saveOrFindVisitor() 外面的😰

scrollViewDidEndDragging

我发现在scrollViewDidEndDragging 实现上下滑分页逻辑的时候,UIScrollView的减速效果很明显,怎么把减速效果去掉

运行崩溃

dyld`dyld_fatal_error:
-> 0x1200f5088 <+0>: brk #0x3
手机 iphone6 plus 8.4.1 xcode 10.1

run failed

iPhone has denied the launch request.
iphone7 12.1 xcode 10.1

AVPlayer问题

你好,当AVPlayer初始化多次后会出现如下问题,导致视频无法正常加载,请问你有解决方案吗

WX20190906-102251

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.