Skip to content

Commit 4038e72

Browse files
Fixed iPad crashes after presenting popovers. (#145)
1 parent 04df5ac commit 4038e72

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

netfox.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Pod::Spec.new do |s|
22
s.name = "netfox"
3-
s.version = "1.14.0"
3+
s.version = "1.15.0"
44
s.summary = "A lightweight, one line setup, iOS/OSX network debugging library!"
5-
5+
66
s.description = <<-DESC
77
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.
88
DESC
@@ -18,5 +18,5 @@ DESC
1818
s.requires_arc = true
1919
s.source_files = "netfox/Core/*.{swift,h,m}"
2020
s.ios.source_files = "netfox/iOS/*.swift"
21-
s.osx.source_files = "netfox/OSX/*.{swift,xib}"
21+
s.osx.source_files = "netfox/OSX/*.{swift,xib}"
2222
end

netfox/iOS/NFXDetailsController_iOS.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,26 +179,27 @@ class NFXDetailsController_iOS: NFXDetailsController, MFMailComposeViewControlle
179179
actionSheetController.addAction(cancelAction)
180180

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

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

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

200200

201201
actionSheetController.view.tintColor = UIColor.NFXOrangeColor()
202+
actionSheetController.popoverPresentationController?.barButtonItem = sender
202203

203204
self.present(actionSheetController, animated: true, completion: nil)
204205
}
@@ -282,7 +283,7 @@ class NFXDetailsController_iOS: NFXDetailsController, MFMailComposeViewControlle
282283
return bodyDetailsController
283284
}
284285

285-
func shareLog(full: Bool)
286+
func shareLog(full: Bool, sender: UIBarButtonItem)
286287
{
287288
var tempString = String()
288289

@@ -308,12 +309,13 @@ class NFXDetailsController_iOS: NFXDetailsController, MFMailComposeViewControlle
308309
tempString += responseFileData
309310
}
310311
}
311-
displayShareSheet(shareContent: tempString)
312+
displayShareSheet(shareContent: tempString, sender: sender)
312313
}
313314

314-
func displayShareSheet(shareContent: String) {
315+
func displayShareSheet(shareContent: String, sender: UIBarButtonItem) {
315316
self.sharedContent = shareContent
316317
let activityViewController = UIActivityViewController(activityItems: [self], applicationActivities: nil)
318+
activityViewController.popoverPresentationController?.barButtonItem = sender
317319
present(activityViewController, animated: true, completion: nil)
318320
}
319321
}

0 commit comments

Comments
 (0)