iOS: Deleted Code Keeps Affecting App - ios

I removed an attribute from an object; I made sure there is no reference to it after I took it off; but when I run the app it crashes upon a certain method saying that it cannot find this attribute that I had removed.
To be more specific, I used this attribute in a method and the error I get in the log is:
2011-08-04 15:32:17.895 myApp[10125:207] -[myUIViewController aMethodName:anAttributeThatIHadDeleted:]: unrecognized selector sent to instance 0x5e5d010
2011-08-04 15:32:17.962 myApp[10125:207] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[myUIViewController aMethodName:anAttributeThatIHadDeleted:]: unrecognized selector sent to instance 0x5e5d010'
I tried the following and it didn't help:
I made sure that this anAttributeThatIHadDeleted does not appear in this method (nor in the h file neither in the m file)
I deleted the app from the iPhone Simulator, and then did Product >> Clean
I even closed the simulator, closed the application, after I did this delete + clean actions
Can anyone think of anything else I can do to resolve this?

If you're absolutely sure the method doesn't exist anymore, I'd delete it from the simulator, quit the simulator, quit XCode, delete the "build" folder in Finder of you project and then start them all again

There was one thing I forgot to do.....
Deleting the Interface Builder >> UIButton connection to the File's Owner IBAction method and re-connecting it to the new one (it was the same one, I just deleted an attribute from it, but apparently it doesn't sync with IB, you have to do it manually...)

Related

How to identify crash from XIB

I don't have any code implemented in view controller to set the font or attributedLabel. But I'm seeing crash with below reason.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: -[_SwiftValue pointSize]: unrecognized selector sent to instance 0x610001040ba0
There is another way of debugging issue. When app is crashed, check left panel and you will observe threads stack. In that find out Obj_exception_throw select that and use your logging area to run command po $arg1. This may give you the correct reason for crashing.
Or else, you can try using Application Unit tests for verifying all your IBOutlets and objects, loaded from NIBs.
You can select that xib and open it as source code.
Or search tho whole project to find that.

Storyboard error with Target Membership(GREYED OUT)

I recently renamed my project and a variety of errors came up relating to the paths that Xcode was trying to use to access my files.
This was most likely due to an ill attempt at renaming the project so I retracted my efforts and decided I would just change the name of the App the customers see. Anyways a peculiar error has risen up because of this.
When I build the app it crashes with a THREAD 1 SIGABRT error. Here is the output of the console.
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: 'Could not find a storyboard
named 'Main' in bundle NSBundle
(loaded)'
*** First throw call stack: (0x18b2341c0 0x189c6c55c 0x191835bd0 0x191306b48 0x1910ef0a8 0x1913057c0 0x19131a080 0x1913028c4
0x18cdd58bc 0x18cdd5728 0x18cdd5ad0 0x18b1e2278 0x18b1e1bc0
0x18b1df7c0 0x18b10e048 0x1910e85dc 0x1910e3360 0x100037bb8
0x18a0f05b8) libc++abi.dylib: terminating with uncaught exception of
type NSException
I have cleaned my project several times as well as doubled check the plist to ensure the string was correct. Here is a link to a similar question whose answer I tried.
Could not find a storyboard named 'Main' in bundle
I found my problem but still am not sure how to fix it. In my main storyboard under The File Inspector my TARGET MEMBERSHIP for the App is GREYED OUT but the Test and UITest version of it are not.
I have tried a variety of build with different checks as well as deleted the app off of my physical device and cleaned the project and tried again. I even deleted the reference to the Main.storyboard and re-added by dragging from a pane like in one of the answers on the link provided and it lets me select all the Target Membership's but when I open the File inspector only the tests are selected on not the main top option. Can anyone help me out on this?
It would be greatly appreciated, I have been at it for hours and I am sure it is something small I am missing.
have you tried to verify the your info.plist?
you can also create a new storyboard (copy all viewController in Main.storyboard) and then in "Main storyboard file base name" key of your plist set the value of your new storyboard name.
Or check this Build Settings:
check also the target associated it.

Today Extension Crashes before launching on iOS 8.1.2

I've been making a today extension that downloads articles from a feed and display the latest ones.
The whole thing worked fine on iOS 8, still worked on iOS 8.1, then came iOS 8.1.2 and we started having complaints about the today extension not working anymore.
I tried debugging on iOS 8.1.2 devices, and before the extension even launch, it crashes with this error :
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: <__NSConcreteUUID 0x174027280> 5AFB07AB-5DCD-46FE-8D07-44DE0F3789F2)'
I have read this post about frequent bugs happening when developing a today extension : http://www.atomicbird.com/blog/ios-app-extension-tip
In his post, Tom Harrington says :
In iOS 8 (and other recent versions), enabling modules in Xcode's build settings means you don't need to explicitly list all the frameworks you want to use. They'll be found automatically.
But this isn't the case with NotificationCenter.framework, which Today extensions use. If you remove that from the build settings, you won't get any build warnings or errors. But when you try to load the extension, you'll get an exception from libextension.dylib and your extension won't load. The exception message is not enlightening:
2014-08-16 12:06:53.793 TodayTestExtension[41313:6111763] * Terminating
app due to uncaught exception 'NSInvalidArgumentException', reason: '*
setObjectForKey: object cannot be nil (key: <__NSConcreteUUID
0x7fd729422390> ED3B42F8-66CD-4CB0-BCD5-F3DBA6F34DB5)'
If you're doing a today extension, just leave that framework in the build settings. It shouldn't need to be there, but it does.
My extension does include NotificationCenter.framework in its build settings, but I suspect my problem might be similar in some way.
Anyone faced a similar problem? Any idea how to solve it?
This error also occurs if you use NSExtensionPrincipalClass inside "Info.plist" in order to define a base class (instead of using a storyboard) with the name of a ViewController which does not exist.
When using Swift, make sure to prefix the class with the module name (usually the name of the target) like "Module.MyViewController".
Eventually I tried to remove NotificationCenter.framework from my target and put it back, cleaned the project, and it's now working again. I guess the framework wasn't properly linked after all, though I could see it on my target with xcode. Also, I can't figure out why it did work, then stopped working with the arrival of 8.1.2.
I fixed this issue by adding the #objc attribute to the Swift class.
#objc(NotificationViewController)
class NotificationViewController: UIViewController, UNNotificationContentExtension {
...
}
Just experienced the same issue. For me, it was "Main Interface" property in "General settings" of the Keyboard target. It was blank, and i set it to my storyboard file and now it works like a charm.

Swapped images in xcode and now app is crashing

I deleted old images in xcode project, default.png, default#2x.png, etc., replaced them all with new images with the SAME SIZE and the SAME NAME - app build succeeded but crashed when opened (didn't go beyond hang screen using testflight)
Git Hard Reset and redeployed - app worked
Changed Images again - app build succeeded but crashed when opened (didn't go beyond hang screen using testflight)
Put back old images manually without reset - app build succeeded but crashed when opened (didn't go beyond hang screen using testflight)
Clearly this is not about the new images because I put them back. No clue what is happening. Not even sure what to google here.
Edit: Sorry, I am very new to this, but I see this at the bottom:
2013-11-07 22:41:17.651 MySaleTable[1934:60b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'MainStoryboard_iPhone' in bundle NSBundle (loaded)'
* First throw call stack:
(0x2d52bf53 0x378556af 0x30146d41 0x2ff15b49 0x2fd07c25 0x2fca26a7 0x2fca19a9 0x2fd074fd 0x3213970d 0x321392f7 0x2d4f69e7 0x2d4f6983 0x2d4f5157 0x2d45fce7 0x2d45facb 0x2fd06799 0x2fd01a41 0x2eb45 0x37d5dab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
Suggest you delete the derived data in the Xcode organizer, close and reopen Xcode. Then open the right pane file browser, and one by one seclect your storyboards and images in the left pane, and verify that it's included in the project. Select your storyboard and verify it loads in the center pane. You can also select the target and insure images and storyboards are in the Copy ToBundle phase (I forget exact name).

Getting an error from the Stanford iOS Class, but my code seems identical

I believe I did what the instructor did verbatim, but my app (it's a simple app) won't work and errors out if I press a button.
I click run, and it builds, but when I click a button in the iOS simulator the app crashes and brings me back to Xcode with an error.
I don't know what I did wrong. It brings me to the main.m file when we didn't even deal with that in the Stanford guide (maybe it has to do with the fact that the Stanford guide uses iOS 5.0 and I'm on 5.1?).
Here's the project if anyone wants to take a lot at it. I'm just really confused.
http://cl.ly/212A3q3J1m1F1y3A041A
(Also, did I just need to include the xcodeproject file, or was I right in including the whole project folder in a zip file?)
It looks like you have your buttons linked to a selector called digitedPressed:
They also appear to correctly be linked to digitPressed. Just remove the references to digitedPressed. (Right click the Calculator View Controller in your storyboard)
Don't forget to check the XCode debugger! This is the error the XCode debugger showed me:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CalculatorViewController digitedPressed:]: unrecognized selector sent to instance 0x9129cc0'

Resources