I am just presenting GMSAutocompleteViewController but it is crashing even though i have made separate application. Crash only happen on release mode but not on debug mode. But ealier ios 15 everything was working. I have added the api key in appdelegate and it is working on debug mode and below is the code:
let autocompleteController = GMSAutocompleteViewController()
autocompleteController.delegate = self
autocompleteController.modalPresentationStyle = .overFullScreen
present(autocompleteController, animated: true, completion: nil)
Application Specific Information:
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
CoreSimulator 802.6.1 - Device: iPhone 13 Pro Max (13ED85A0-1287-44A4-B21F-CD56D7109BCC) - Runtime: iOS 15.5 (19F70) - DeviceType: iPhone 13 Pro Max
terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <NSConcreteMapTable: 0x7f780792d7d0> was mutated while being enumerated.'
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot**
Related
I'm trying to embed an youtube video in swiftUI app (building for iOS 14)
i'm using CocoaPods with the following Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '14.0'
target 'TestProjectYoutube' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for TestProjectYoutube
pod 'Alamofire', '~> 5.0'
pod 'SwiftyJSON', '~> 4.0'
pod 'URLImage'
pod 'Introspect'
end
I've created the following view
import SwiftUI
import CoreData
struct ContentView: View {
#Environment(\.managedObjectContext) private var viewContext
var body: some View {
VStack() {
VideoView(videoID: "CX-BdDHW0Ho")
}
}
}
struct VideoView: UIViewRepresentable {
let videoID: String
func makeUIView(context: Context) -> WKWebView {
let webView = WKWebView(frame: CGRect(x: 0.0, y: 0.0, width: 0.1, height: 0.1))
return webView
}
func updateUIView(_ uiView: WKWebView, context: Context) {
guard let youtubeURL = URL(string: "https://www.youtube.com/embed/\(videoID)") else { return }
uiView.scrollView.isScrollEnabled = false
uiView.load(URLRequest(url: youtubeURL))
}
}
The error i got is:
2023-01-16 15:35:16.130698+0100 app[44720:3273388] -[__NSArrayM length]: unrecognized selector sent to instance 0x2824115c0
2023-01-16 15:35:16.130920+0100 app[44720:3273388] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM length]: unrecognized selector sent to instance 0x2824115c0'
*** First throw call stack:
(0x18048bc80 0x197cb1ee4 0x18055c708 0x18042556c 0x18042477c 0x18ac78644 0x18e74ce50 0x18e9d0ca4 0x18e9d0888 0x18e94c418 0x18e963de0 0x18ecdd224 0x18ecdcec8 0x18e72b69c 0x18e727c4c 0x18e72cd18 0x18ac73590 0x18ac7410c 0x1804ac468 0x1804bc598 0x1803fe774 0x180403e48 0x180417194 0x1a0f56988 0x182c1aa88 0x1829b3fc8 0x187c6cd68 0x187bb783c 0x187b9d1dc 0x10281f3fc 0x10281f530 0x102ff84d0)
libc++abi: terminating with uncaught exception of type NSException
dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM length]: unrecognized selector sent to instance 0x2824115c0'
terminating with uncaught exception of type NSException
When I replace the youtube.com with google.com, i dont get the error and google is loaded.
Can someone help me with this?
I have this code
let picker = UIImagePickerController()
picker.sourceType = .camera
picker.cameraDevice = .rear
picker.mediaTypes = [kUTTypeMovie as String]
picker.cameraCaptureMode = .video
picker.videoMaximumDuration = 15.0
picker.videoQuality = .typeLow
picker.allowsEditing = true
picker.delegate = self
picker.showsCameraControls = true
self.present(picker, animated: true, completion: nil)
This code work properly below iOS 14. On iOS 14 show black screen on preview and doesn't record video or taking photo.
I set properly:
Privacy - Camera Usage Description
Privacy - Media Library Usage Description
Privacy - Microphone Usage Description
Privacy - Photo Library Usage Description
I check this:
UIImagePickerController.isCameraDeviceAvailable(.rear)
UIImagePickerController.isSourceTypeAvailable(.camera)
Both methods return true.
I don't use modal dialogs for starting UIImagePickerController.
In console I see this messages:
[Camera] Failed to read exposureBiasesByMode dictionary: Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: data is NULL" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: data is NULL}
[Camera] [CAMCaptureEngine] Received a session runtime error notification : Error Domain=AVFoundationErrorDomain Code=-11819 "Cannot Complete Action" UserInfo={NSLocalizedDescription=Cannot Complete Action, NSLocalizedRecoverySuggestion=Try again later.}
Xcode Version 12.4 (12D4e)
Update:
I found problem. If comment picker.videoQuality = .typeLow it will works on iOS 14.
Why I can't use low quality on iOS14?
I'm creating an app that users AVFoundation to record a video. I have a Login View Contoller which leads to a View Controller (user can see their profile details here) which leads to a Data Collection View Controller (this is where the video camera is presented). All works fine but when I click on a back button to go back to the View Controller, and then click 'start data collection' to go back into the video camera a 2nd time, the app crashes.
Crash info:
2018-08-11 11:39:51.861569+0100 LiopaDatacapture-iOS[6343:1642808] *
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '* -[AVCaptureMetadataOutput
setMetadataObjectTypes:] Unsupported type found - use
-availableMetadataObjectTypes'
*** First throw call stack: (0x1842e6d8c 0x1834a05ec 0x189e54b44 0x10128f4fc 0x1012989a4 0x101298ca4 0x18df01e64 0x18df01a50
0x18eaa4fd8 0x18e12b398 0x18e12a25c 0x18e3a33a0 0x18e0e13e4
0x18e1297bc 0x18e129654 0x18e3a6350 0x18e734d24 0x18e881af4
0x18e8819a0 0x18e39a49c 0x101297f5c 0x18e05564c 0x18e176870
0x18e05b700 0x18e1911a8 0x18e0d89e0 0x18e0cd890 0x18e0cc1d0
0x18e8add1c 0x18e8b02c8 0x18e8a9368 0x18428f404 0x18428ec2c
0x18428c79c 0x1841acda8 0x186192020 0x18e1cc758 0x101284a90
0x183c3dfc0) libc++abi.dylib: terminating with uncaught exception of
type NSException (lldb)
I'm using AVCaptureMetadataOutput to detect faces. This code is in my SessionHandler class where the video camera is being set up.
// define metadata
let metaOutput = AVCaptureMetadataOutput()
if cameraSession.canAddOutput(metaOutput) {
metaOutput.setMetadataObjectsDelegate(self, queue: faceQueue)
cameraSession.addOutput(metaOutput)
print("metaoutput added")
}
// set metadata to look for faces
metaOutput.metadataObjectTypes = [AVMetadataObject.ObjectType.face]
In my DataCaptureViewController.swift file this is where I load the video camera-
override func viewDidLoad() {
super.viewDidLoad()
sessionHandler.setupCamera()
audioRecorder.setUpAudioSession()
createObservers()
let layer = sessionHandler.layer
layer.frame = previewView.bounds
previewView.layer.addSublayer(layer)
view.layoutIfNeeded()
jsonSentence.text = "Press start button to get phrase"
startButton.setTitle("Start", for: .normal)
}
I've played around a bit trying viewDidAppear and viewWillAppear but I'm new to swift and don't think I fully understand what they do or if this is what's causing the problem.
The SessionHandler class variables need to be shared with an Objective-C class so I've created a shared instance of it to be used throughout the app.
static let sharedSession = SessionHandler()
It's hard to know what code is useful to share but if you need any more info I'm happy to provide it.
The answer seemed pretty straightforward in the end, sorry for the big question!
It was because the metadataObjectTypes was empty when the DataCaptureViewController was reloaded. So I created a viewDidAppear method and set the metadataObjectTypes to face in there.
override func viewDidLoad() {
super.viewDidLoad()
sessionHandler.setupCamera()
audioRecorder.setUpAudioSession()
createObservers()
let layer = sessionHandler.layer
layer.frame = previewView.bounds
previewView.layer.addSublayer(layer)
view.layoutIfNeeded()
jsonSentence.text = "Press start button to get phrase"
startButton.setTitle("Start", for: .normal)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
sessionHandler.metaOutput.metadataObjectTypes = [AVMetadataObject.ObjectType.face]
}
The app seems to be working now. If I've done this incorrectly though feel free to correct!
var datePickerView: UIDatePicker = UIDatePicker()
override func viewDidLoad() {
super.viewDidLoad()
initializeBarButtons() }
func initializeBarButtons() {
datePickerView.datePickerMode = UIDatePickerMode.date // This is the line that gets the error
datePickerView.addTarget(self, action: #selector(EmployeeDetailEditViewController.handleDatePicker), for: UIControlEvents.valueChanged)
}
This commented line is causing the crash when the calendar is changed from Gregorian to Buddhist.
Crash : -
Terminating app due to uncaught exception 'NSRangeException', reason:
'* -[__NSArrayM objectAtIndex:]: index 9223372036854775807 beyond
bounds [0 .. 1]'
* First throw call stack: (0x18626e364 0x1854b4528 0x186206e9c 0x186136840 0x18f9a1890 0x1902238a8 0x19022045c 0x1902210f4
0x19022139c 0x190214254 0x1902136cc 0x190213c08 0x190213d24
0x1013881e0 0x101386d1c 0x101387018 0x18f768590 0x18f768304
0x18f8d2bd4 0x18f7f5c4c 0x18f7f5890 0x18f7f5790 0x1a53e4c18
0x18f74cf00 0x18a2b1998 0x18a2b5b20 0x18a22236c 0x18a249b90
0x18a24a9d0 0x186215edc 0x186213894 0x186213e50 0x186133e58
0x187fe0f84 0x18f7b367c 0x10131b378 0x185c5056c) libc++abi.dylib:
terminating with uncaught exception of type NSException
How to Solve This ?
Unfortunately, you can't solve it, as there is an open radar on it (https://openradar.appspot.com/41120005).
Meanwhile, use #Amey workaround:
if #available(iOS 11.0, *) {
let gregorianCalendar = Calendar(identifier: .gregorian)
self.datePickerView.calendar = gregorianCalendar
} else {
// Fallback on earlier versions
}
I'm using the following library:
https://github.com/lukabernardi/LBBlurredImage
This is the code I'm using to blur my background image that I'm adding to a ViewController:
var background = UIImage(named: "bg")
var backgroundImageView = UIImageView(image: background)
backgroundImageView.contentMode = .ScaleAspectFill;
backgroundImageView.setImageToBlur(background, blurRadius: 10, completionBlock: { () -> Void in
println("The blurred image has been set")
})
self.view.addSubview(backgroundImageView)
I'm getting the following error and I'm not sure why:
-[UIImageView setImageToBlur:blurRadius:completionBlock:]: unrecognized selector sent to instance 0x7ff08a802390
2015-01-27 10:50:44.326 TestApp[9289:66346] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView setImageToBlur:blurRadius:completionBlock:]: unrecognized selector sent to instance 0x7ff08a802390'
UPDATE:
Looks like I'm not the only one to receive the error.
Exception was that the image I was passing was nil and in turn it was violating NSParameterAssert(image);
var background = UIImage(named: "bg")
Instead of this try to specify the full path of the image.
It worked for me and I am pretty sure it will work for you too.
You can also try this path with your code
var background = UIImage(named: "Images/bg");