简体   繁体   中英

Skyepub on swift2 showing blank page

I am implementing an ePub reader on iOs in swift2 with Skyepub. I downloaded the SDK and Sample. Created a project with just a single ViewController.

On the ViewDidLoad i made a call to makeBookViewer

    var fileName: String
    fileName = "Alice-e.epub"
    self.makeBookViewer(fileName)

which is copied from the sample app and converted to swift.

func makeBookViewer(fileName: String) {

print("BaseDirectory: \(self.getBaseDirectory())")

let rv = ReflowableViewController(startPagePositionInBook:0.0)
rv.book.isFixedLayout = false
rv.book.fontSize = 12
rv.book.fileName = fileName
rv.book.bookCode = 123456
rv.baseDirectory = self.getBaseDirectory()
rv.transitionType = 0
rv.useDOMHighlight(false)
if self.isPad() {
    rv.setVerticalGapRatio(0.17)
}
else {
    rv.setVerticalGapRatio(0.20)
}
rv.setHorizontalGapRatio(0.3)
rv.setGlobalPaging(true)
rv.showIndicatorWhileLoadingChapter(false)
rv.showIndicatorWhilePaging(false)
rv.showIndicatorWhileRotating(true)
rv.allowPageTransitionFast(true)
rv.setCustomDrawHighlight(true)

rv.dataSource = self
rv.delegate = self

let skyProvider: SkyProvider = SkyProvider()
skyProvider.dataSource = self
skyProvider.book = rv.book
rv.setContentProvider(skyProvider)
rv.setGlobalOffset(true)
rv.setDrawingHighlightOnFront(false)

self.addChildViewController(rv)
rv.view.frame = self.view.frame
rv.view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
self.view!.addSubview(rv.view!)
self.view.autoresizesSubviews = true

}

The ViewController shows a blank white page showing watermark "Unlicensed". immediately an activity indicator is shown. Then nothing happens.

On the log i can see

BaseDirectory: /Users/me/Library/Developer/CoreSimulator/Devices/6727DD2E-38BE-40E1/data/Containers/Data/Application/185322CD-BCA8-467B/Documents
2016-05-27 20:09:40.882 MyEPub[6296:175309] Application (null) Version 1 Copyrights (null)
2016-05-27 20:09:40.883 MyEPub[6296:175309] Application (null) Version 1 Copyrights (null)
2016-05-27 20:09:40.883 MyEPub[6296:175309] dealloc in Book
2016-05-27 20:09:40.884 MyEPub[6296:175309] destroy in Book
2016-05-27 20:09:40.884 MyEPub[6296:175309] processInit
2016-05-27 20:09:40.885 MyEPub[6296:175309] startServer 52326
2016-05-27 20:09:40.930 MyEPub[6296:175309] parseEncryption finished
2016-05-27 20:09:40.940 MyEPub[6296:175309] parseOpf Complete
2016-05-27 20:09:40.940 MyEPub[6296:175309] book parseXML finished

On the Skyepub sample the log further proceeds

I have copied the ePub file from Skyepub sample's book folder to BaseDirectory of mine. Can anyone give a hint what i have missed.

make weak var like:

weak var weakself = self

rv.dataSource = weakself
rv.delegate = weakself

skyProvider.dataSource = weakself

maybe this can help you

I had to create the view-controller in objective-c where I am using the skyepub book view. That solved the above issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM