Skip to content

Commit

Permalink
Fixed iPad crashes after presenting popovers. (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofpelczarinfullmobile authored and felipeflorencio committed Feb 10, 2019
1 parent 04df5ac commit 4038e72
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions netfox.podspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Pod::Spec.new do |s|
s.name = "netfox"
s.version = "1.14.0"
s.version = "1.15.0"
s.summary = "A lightweight, one line setup, iOS/OSX network debugging library!"

s.description = <<-DESC
A lightweight, one line setup, network debugging library that provides a quick look on all executed network requests performed by your app. It grabs all requests - of course yours, requests from 3rd party libraries (such as AFNetworking or else), UIWebViews, and more. Very useful and handy for network related issues and bugs.
DESC
Expand All @@ -18,5 +18,5 @@ DESC
s.requires_arc = true
s.source_files = "netfox/Core/*.{swift,h,m}"
s.ios.source_files = "netfox/iOS/*.swift"
s.osx.source_files = "netfox/OSX/*.{swift,xib}"
s.osx.source_files = "netfox/OSX/*.{swift,xib}"
end
14 changes: 8 additions & 6 deletions netfox/iOS/NFXDetailsController_iOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,26 +179,27 @@ class NFXDetailsController_iOS: NFXDetailsController, MFMailComposeViewControlle
actionSheetController.addAction(cancelAction)

let simpleLog: UIAlertAction = UIAlertAction(title: "Simple log", style: .default) { [unowned self] action -> Void in
self.shareLog(full: false)
self.shareLog(full: false, sender: sender)
}
actionSheetController.addAction(simpleLog)

let fullLogAction: UIAlertAction = UIAlertAction(title: "Full log", style: .default) { [unowned self] action -> Void in
self.shareLog(full: true)
self.shareLog(full: true, sender: sender)
}
actionSheetController.addAction(fullLogAction)

if let reqCurl = self.selectedModel.requestCurl {
let curlAction: UIAlertAction = UIAlertAction(title: "Export request as curl", style: .default) { [unowned self] action -> Void in
let activityViewController = UIActivityViewController(activityItems: [reqCurl], applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self.view
activityViewController.popoverPresentationController?.barButtonItem = sender
self.present(activityViewController, animated: true, completion: nil)
}
actionSheetController.addAction(curlAction)
}


actionSheetController.view.tintColor = UIColor.NFXOrangeColor()
actionSheetController.popoverPresentationController?.barButtonItem = sender

self.present(actionSheetController, animated: true, completion: nil)
}
Expand Down Expand Up @@ -282,7 +283,7 @@ class NFXDetailsController_iOS: NFXDetailsController, MFMailComposeViewControlle
return bodyDetailsController
}

func shareLog(full: Bool)
func shareLog(full: Bool, sender: UIBarButtonItem)
{
var tempString = String()

Expand All @@ -308,12 +309,13 @@ class NFXDetailsController_iOS: NFXDetailsController, MFMailComposeViewControlle
tempString += responseFileData
}
}
displayShareSheet(shareContent: tempString)
displayShareSheet(shareContent: tempString, sender: sender)
}

func displayShareSheet(shareContent: String) {
func displayShareSheet(shareContent: String, sender: UIBarButtonItem) {
self.sharedContent = shareContent
let activityViewController = UIActivityViewController(activityItems: [self], applicationActivities: nil)
activityViewController.popoverPresentationController?.barButtonItem = sender
present(activityViewController, animated: true, completion: nil)
}
}
Expand Down

0 comments on commit 4038e72

Please sign in to comment.