Using tableView function scrollToRow it crashed

When a tableView is scrolling I update dataSource and invoke tableView function reloadData. After tableView DidEndDecelerating I invoke the function: let indexPath = IndexPath(row: row, section: 0) if row < dataModels.count { tableView.scrollToRow(at: indexPath, at: .top, animated: true) } Sometimes it will crash. The crash log likes below: 0 CoreFoundation __exceptionPreprocess 1 libobjc.A.dylib objc_exception_throw 2 […]

By dowZhang
Published
Categorised as ios Tagged

When autorelease pool release object in background thread?

I know autorelease pool will release objects when the runloop in the state kCFRunLoopBeforeWaiting. So I create a background thread which runloop doesn’t run by default. If I use an autorelease pool in this background thread, when does it release objects. Source: Ios

By dowZhang
Published
Categorised as ios, nsautoreleasepool, runloop

How Can I set timeout interval when use bluetooth

When I use bluetooth to write data, I hope get response. But when the peripheral goes wrong, it doesn’t send notification. I need set a timeout interval to handle this bad interaction. Like we use urlrequest: /// Creates and initializes a URLRequest with the given URL and cache policy. /// – parameter: url The URL […]

By dowZhang
Published
Categorised as bluetooth, ios

Why is it error when my framework contains .framework file

My project uses cocoapods to manager frameworks. The podfile contains the command line use_frameworks! One of my framework core depends on another framework UMCCommon. So core framework’s podspec file has command line s.dependency ‘UMCCommon’ But the UMCCommon have a UMCCommen.framework file. Then I get an error likes below: If I add the line s.static_framework = […]

By dowZhang
Published
Categorised as cocoapods, ios

Why timer invoke its block so quickly sometimes

I create a timer and invoke its block every 5 second. Then I make application to enter background and enter foreground after a while. But it could invoke the block quickly sometimes. let _ = Timer.scheduledTimer(withTimeInterval: 5.0, repeats: true) { (timer) in print(“——–“) } When I enter foreground the interval of first printing and second […]

By dowZhang
Published
Categorised as ios, nstimer

Why UIPresentationController’s height is changed when present another controller?

I use UIPresentationController to show bottom tip. Sometimes the presentationController may present another controller. And When the presented controller is dismissed, the presentationController’s height was changed. So why does it changed and how can i solve this problem. The code likes below: class ViewController: UIViewController { let presentVC = UIViewController() override func viewDidLoad() { super.viewDidLoad() […]

By dowZhang
Published
Categorised as ios, swift, uipresentationcontroller

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq