I am adding some data into my parse class (table) successfully.
After saving is successfully completed (I can see the data on website), my app crashes without leaving any message on console. I tried to get a message by using "Enable Zombie Objects" setting. This is the message I am getting which has nothing to do what I am doing:
-[UIActivityIndicatorView release]: message sent to deallocated instance 0x126d16780
I do not have any UIActivityIndicatorView in my whole project.
This is how I save my data:
var currentUser = PFUser.currentUser()!
var userCase = PFObject(className: "Case")
userCase.relationForKey("user").addObject(currentUser)
userCase["caseCode"] = "test_code"
userCase.saveInBackgroundWithBlock {
(success: Bool, error: NSError?) -> Void in
if (success) {
// The object has been saved.
println("saved")
} else {
// There was a problem, check error.description
println("error occurred: \(error?.description)")
}
}
Swift SDK version: 1.7.5
Xcode version: 6.4
Has anybody have ever faced with such problem?
UPDATE: This error does not occur on simulator (tested on iPhone 5, iPhone 5S, iPhone 6) and does not occur on device at first run.
Tried removing and re-installing the app.
UPDATE 2: Removing PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions) or changing it to PFFacebookUtils.initialize() from AppDelegate fixes the issue but I think I need to use initializeFacebookWithApplicationLaunchOptions(launchOptions). I have another problem now.
You may do the following.
1) Go to PFFacebookUtils.h
2) change:
(void)initializeFacebookWithApplicationLaunchOptions:(NSDictionary *)launchOptions;
To:
(void)initializeFacebookWithApplicationLaunchOptions:(PF_NULLABLE NSDictionary *)launchOptions;
It was originally posted here
Related
I have searched enough but failed to get a solution.
I am using ReplayKit to record the screen of my app. I have started recording the screen by calling
let sharedRecorder = RPScreenRecorder.shared()
sharedRecorder.startRecording() { error in
if let error = error {
self.showScreenRecordingAlert(message: error.localizedDescription)
}
}
When I am pressing the stopRecord button I am calling
let sharedRecorder = RPScreenRecorder.shared()
sharedRecorder.stopRecording { previewViewController, error in
if let error = error {
self.showScreenRecordingAlert(message : error.localizedDescription)
return
}
}
But the issue that I am facing is, the program control does not enter inside the stopRecording block.
When I am doing po sharedRecorder.isRecording, it always returns false.
I have done everything I know but failed to get a solution.
If you having this above issue with your code i have found the solution for this.
let sharedRecorder = RPScreenRecorder.shared()
sharedRecorder.stopRecording { previewViewController, error in
if let error = error {
self.showScreenRecordingAlert(message : error.localizedDescription)
return
}}
Above Block will not call if you running your app on simulator so please use real device to test then above method will call definitely.
Thank you.
Just had this issue running XCode 9.4.1 and building onto iOS 11.4.0. Upgrading the phone to iOS 11.4.1 fixed the bug. I'm not sure if the difference in XCode versions is the root cause or if 11.4.0 was just broken.
I am using a singleton class to select data from CoreData, and send it back to the calling ViewController. My issue is that when getting one of the ManagedObject's properties, the app crashes with an EXC_BAD_ACCESS exception.
This only seems to happen on iOS 9.x or on the simulator, but is pretty consistent on those. It hasn't happened on a device running 10.x. I set the scheme diagnostics to show zombie objects, and am now presented with the following error:
-[CFString copy]: message sent to deallocated instance 0x15b92990
The issue is that the string being referenced is on an object retrieved directly before I get this error, and I am using Swift (So not manually deallocating anything), so I don't understand why it is deallocated.
The code that selects the object looks like this:
func getModelTypePrice(mmCode: String, year: Int) -> ModelTypePrice? {
let request = NSFetchRequest<ModelTypePrice>(entityName: "ModelTypePrice")
request.predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [NSPredicate(format: "mmcode = %#", mmCode),
NSPredicate(format: "reg_year = %d", year)])
do {
let prices = try managedContext.fetch(request)
if prices.count == 1 {
return prices[0]
}
} catch {
print("Error selecting object: \(error)")
}
return nil
}
That is called from the ViewController, and used as follows:
if let price = LibraryAPI.sharedInstance.getModelTypePrice(mmCode: "123", year: 2017) {
self.newPrice = price.new_price // Error happens here.
}
The ViewController does have an optional String property called newPrice. The new_price property on a ModelTypePrice is also an optional String.
I am at a bit of a loss here, so any advice or suggestions would be appreciated.
This fixed it: [CFNumber release]: message sent to deallocated instance
The problem was the name of the property of the managed object starting with new(it was new_price). Changing it to price_new fixed it. Apparently they changed how this is handled in iOS 10.x, as it was never a problem there.
Maybe this saves someone else some frustration.
I have a fairly simple app that parses a RSS feed and shows it's content in a table view. It's available on the App Store. I have Crashlytics crash reporting integrated. I recently received two reports. These are a little difficult to decipher.
This has occurred in an iPhone 6 running iOS 10.2.1.
This is from an iPhone 5 running iOS 10.2.1.
Even though it says it's crashing due to privacy violations, I'm not accessing any services that requires permission in my app.
Also searching on com.apple.root.default-qos lead me to believe that this may have something to do with background threads. The only place where I use a background thread is to parse the RSS feed data.
DispatchQueue.global(qos: .background).async {
guard let data = try? Data(contentsOf: URL) else {
return
}
do {
let xmlDoc = try AEXMLDocument(xml: data)
if let items = xmlDoc.root["channel"]["item"].all {
self.posts.removeAll()
for item in items {
let title = item["title"].value ?? ""
// ...
self.posts.append(jobPost)
}
DispatchQueue.main.async {
self.saveposts(self.posts)
self.posts.sort { $0.publishDate > $1.publishDate }
self.tableView.reloadData()
UIApplication.shared.toggleNetworkActivityIndicator(show: false)
self.toggleUI(enable: true)
if self.refreshControl.isRefreshing { self.refreshControl.endRefreshing() }
}
}
} catch let error as NSError {
print("RSS parsing failed: \(error)")
self.showErrorAlert(error)
UIApplication.shared.toggleNetworkActivityIndicator(show: false)
self.toggleUI(enable: true)
if self.refreshControl.isRefreshing { self.refreshControl.endRefreshing() }
}
}
I tested this code on my iPhone 5 running iOS 9.3.5 and simulators running iOS 10.2 but no crash occurred.
Is there any other way to track down this problem?
I would double check all your permissions. In my case, starting with iOS10 you need permissions to save stuff to the user's camera roll. In my app, I was showing a default share sheet and whenever a user selected "save photo" the app crashed with one of these very not helpful error messages. I added
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Allow you to save charts and graphs from the app to your phone.</string>
to my info.plist, clean & run. And everything the problem was solved.
I updated Xcode to the new Xcode 7 beta 5. In doing so, it converted to Swift 2, but then created even more errors. Right now, I am completely stuck, and don't know what to do, because although all my errors are gone, my app will not work correctly.
My problem is this:
if(self.myOutput3 as? NSObject == true) {
print("IT IS TRUE")
PFUser.logInWithUsernameInBackground(self.myOutput1 as! String, password: "xxx") { (user: PFUser?, error: NSError?) -> Void in
if error == nil {
print("It Worked!")
// self.presentViewController(destViewController, animated: true, completion: nil)
let instillation = PFInstallation.currentInstallation()
instillation["user"] = PFUser.currentUser()
instillation.saveInBackgroundWithBlock(nil)
self.performSegueWithIdentifier("toTimeline", sender: self)
} else {
// self.enterButton.enabled = false
self.errorAlert()
print("Couldn't log in...")
}
}
} else {
print("IT IS FALSE")
self.performSegueWithIdentifier("continueTheSignIn", sender: self)
// self.move()
}
The program will perform the toTimeline segue, but not the continueTheSignIn . I don't see any logical reason that this is not working. Could anyone point me in the right direction?
Also, I am having an error in my messages feature.
cell.textView!.linkTextAttributes = [NSForegroundColorAttributeName:cell.textView!.textColor]
This is giving me the error "Cannot assign a value of type '[String : UIColor?]' to a value of type '[String: AnyObject]!'
I was not previously getting this error in Swift / Xcode 6.4, so I don't know how to fix it.
Additionally, once I bypass this to get into my app to see if my other features are working, most of my UITableViews are not displaying any information. One is, however the rest load the correct amount of rows, but display nothing. What could this be? Also, no Parse pictures are being displayed correctly either. These are even more concerning than the other problems...
Here is the picture after I deleted and re added the segue under a diff. name.
Parse wont support the beta version . it needs a full version . I have contacted them based on a similar issue . They said they will update the parse to work with xcode7 once the full version of xcode7 is released.
I am using the below code to save the currently logged in user with custom field. I allow the user to fill in information and then save. I used both the save methods on my own threading using GCM and used the saveInBackgrounWithBlock. On iOS8, this works ok but on iOS7 saving never happens and the completion block is never called. Any ideas? Thanks
if PFUser.currentUser() != nil {
PFUser.currentUser().setObject(installation, forKey: "installation")
PFUser.currentUser().saveInBackgroundWithBlock({ (bool: Bool, error: NSError?) -> Void in
if(error != nil) {
let alert = UIAlertView(title: "Problem Saving", message: "Make sure you are connecte to the internet and try again", delegate: nil, cancelButtonTitle: "OK")
alert.show();
}
})
}
Update 1: I noticed that deleting the app resolves the issue temporarily. However, after signing out and signing in with other user (i.e. changing the current user), the issue will pop up again.
Update 2: The issue seems to be coming from PFInstallation somehow. Using addUniqueObject causes issues. After calling this method, any saves stops working iOS7. Even on the PFUser. The PFUser has the installation setup and vice versa. An array of them.
Update 3: Seems like it's not just the addUniqueObject, but any setObject on the PFInstallation.currentInstallation. Help!
you should check your first param (isSuccess) as well:
if (bool == YES && error != nil) -> success
else -> failure
It took me a long while to realise, and even though I never actually found a solution to the problem itself, I found a workaround. I was saving the currentUser in the currentInstallation and the currentInstallation in the currentUser. This was causing issues when saving. I also saved channels on the currentInstallation by sending an array of channels directly instead of using addUniqueObject.
let installation = PFInstallation.currentInstallation()
installation.channels = channels;
installation.saveInBackground()