Warning unable to restore previous frame and giving error: EXC_BAD_ACCESS - iphone

My iPhone app crashes and gives the following warning
warning: Unable to restore previously selected frame.
Current language: auto; currently objective-c
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
warning: Unable to restore previously selected frame.
Here is code where actauly it crashes
+(id) tbxmlWithURL:(NSURL*)aURL;{
return [[TBXML alloc] initWithURL:aURL];
}
-(id)initWithURL:(NSURL*)aURL{
return [self initWithURL:aURL];
}

Your -initWithURL: method is calling itself recursively. Each time it does that, it adds a stack frame, and eventually you run out of stack space and crash. The debugger typically doesn't give you much useful information when that happens.
Did you mean this?
-(id)initWithURL:(NSURL*)aURL{
return [super initWithURL:aURL];
}

Related

GWT Error Popup

The error popup with the following error message comes on the screen repeatedly when application is in idle state (no user activity is performed).
Error occurred on client: (TypeError): Unable to get property 'iterator_0' of undefined or null reference.
number: -2146823281
at handleEvent_206....EF34544...cache.html
at dispatchEvent_0..EF34544...cache.html
at sucess_184 ..
..
Can anyone give some pointers to navigate to the problamatic area in the code?
The fact that you're getting it repeatedly is probably due to the fact that you're performing an action on a timer (i.e. perform repeatedly an action).
From the small snippet you've shown, I don't think there's anything we can deduce. Do you have a larger stacktrace? It is still possible the error is in your own code (trying to invoke iterator() on a null object).

Core Data commands crash ViewController even after delete

I was trying to add autosaving to my Core Data-based app and there was a line of code I added to textDidChange in a CollectionViewItem:
theNote?.updateChangeCount(NSDocumentChangeType.ChangeDone)
That gave me a lot of errors, so I commented out the line. I then went in to delete the CocoaAppCD.storedata persistent store file to make it cleaner (I'm still in early dev stages so all that goes in my persistent store is random test materials).
Now, I'm finding, Core Data commands crash my ViewController. Specifically this function:
func createNewNotebook(folderURL: NSURL)
{
let currentNotebook = Notebook(entity: sv.noteType, insertIntoManagedObjectContext:sv.context)
currentNotebook.folderURLstring = folderURL.absoluteString
let noteSet = currentNotebook.mutableSetValueForKey("contains")
print(String(noteSet))
intakeFilesFromFolder(noteSet, currentFolderURL: folderURL)
}
(Notebook and NoteEntity are the two entity types in my Core Data model.) When either the currentNotebook.folder... or let noteSet... commands run, I get these errors in my console:
Brouillon.NoteEntity folderURLstring]: unrecognized selector sent to instance 0x6080000a3a20
2016-07-24 19:27:02.622 Brouillon[8006:361665] Failed to set (contentViewController) user defined inspected property on (NSWindow): -[Brouillon.NoteEntity folderURLstring]: unrecognized selector sent to instance 0x6080000a3a20
and the WindowController is empty with no view filling it (even though these same statements had worked before I added the now-commented-out line). But if I bypass this function so the Core Data statements don't run, the views load. I would have thought that if I had anything dirty left in the database, deleting the CocoaAppCD.storedata file should have fixed it (and I keep deleting that file after every run). But it seems like something in Core Data is still mucked up for me - any ideas?
I figured this out. The problem was I had declared the wrong entity type: my sv.noteType should have been sv.notebookType, since it was a Notebook rather than a NoteEntity. (The error would have been introduced when I was creating the class instantiated as sv, as a class to hold my otherwise-duplicated code.)

Timestamped Event Matching Error: Failed to find matching element

I'm trying to generate a UItest in Xcode. When I try to swipe UIview I get
an error:
Timestamped Event Matching Error: Failed to find matching element
error window
This also happens if I try to tap UIView.
You should verify that the 'Accessibility' option is enabled for the UIView object you are swiping from, for example:
Usually this issue is observed when the parent element of the element yo want to record is set to isAccessibilityElement = true. In general, you have to have the parent element set to false to access the child element.
For example: if you have a UILabel inside a view, the accessibility should be set to false for the view and set to true for the UILabel.
For recording a new test, I don't think there's a solution yet. But, if you use an extension forcing tap with a test that already exists, works.
Example of use:
extension XCUIElement {
func forceTapElement() {
if self.hittable {
self.tap()
}
else {
let coordinate: XCUICoordinate = self.coordinateWithNormalizedOffset(CGVectorMake(0.0, 0.0))
coordinate.tap()
}
}
}
func testSomethingWithCells() {
let app = XCUIApplication()
let cells = app.tables.cells
sleep(1)
cells.elementBoundByIndex(0).forceTapElement()
}
You can check the original post here:
Xcode UI test - UI Testing Failure - Failed to scroll to visible (by AX action) when tap on Search field "Cancel' button
I've been occasionally running into this problem. Delete the app's directory from DerivedData seems to help.
In Xcode 9.3, where this is apparently still a problem, what I did was:
Quit Xcode
Reset the Simulator's settings (Hardware -> Erase all
contents and settings)
Quit the Simulator
Delete the derived data for the current app
Restart Xcode
Try recording again - it worked this time for me.
A solution that worked for myself was to identify the object differently.
In Xcode 8 I was able to use the following:
XCUIApplication().tables.cells["Camera Roll"].buttons["Camera Roll"].tap()
With Xcode 9 I got the error mentioned in this question. Ended up using the following, which worked (al beit more flakey than the original option)
XCUIApplication().cells.element(boundBy: 1).tap()
Even if you have Accessibility enabled for the element, you have to make sure that it has a unique accessibility identifier. In my case, I had copied & pasted a UISwitch and assigned a different outlet to it, but it kept the same accessibility ID as the original one.

Why am I getting a an 'instance method not found' message here?

I'm currently using the MKHorizMenu class found here and I'm trying to understand why I am getting an instance method not found message.
I'm trying to have the app programatically do the equivalent of tapping on of the items on the view controllers first load.
My code:
// Actually select the item
[self.horizMenu.itemSelectedDelegate horizMenu:self.horizMenu itemSelectedAtIndex:0];
// Tap the button (change its background image etc)
NSArray *subs = [self.horizMenu subviews];
[self.horizMenu buttonTapped:(id)[subs objectAtIndex:0]]; // guilty line
The warning:
warning: instance method '-buttonTapped:' not found (return type defaults to 'id')
In the MKHorizMenu class the method is defined as:
-(void) buttonTapped:(id) sender
When I run the code, it performs as desired - it appears as if the first button has been tapped, and the first item is selected.
Why do I get this warning? How can I call buttonTapped properly here?
You can stop the warning by adding the method declaration for buttonTapped: to the header file for the class.

Strange, Sudden compiler fail error in Xcode for iPhone dev

What is the following error caused by? I did not make any significant changes and suddenly it started appearing:
Linking /Users/JimB/Desktop/iPhone Dev/Games4Kids/build/Debug-iphonesimulator/ETFanClub.app/Games4Kids(1 error)
duplicate symbol .objc_category_nameNSString_HTTPExtensions in (path)ViewController3 and (path)ViewController1
Command /Xcode 3.1.4/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
The symbol .objc_category_nameNSString_HTTPExtensions is duplicated, meaning the category NSString(HTTPExtensions) is declared twice ViewController3 and ViewController1.
Check that you don't have #implementation's in the headers #import-ed by both of these files, and they don't both have #implementation NSString(HTTPExtensions) simultaneously.