RestKit Errors after Xcode crash - ios

I've been using RestKit in a project for the last couple of months without any issues. I have it set up as per the instructions on the Github wiki. Today Xcode hung while connecting to the simulator. I had just edited some trivial UI code completely unrelated to anything touching RestKit. I had to force quit Xcode and restart. When I restarted and compiled again, RestKit built successfully but I got a string of Errors related to my application. On closer inspection they are all related to RestKit. There are a cascade of errors starting in RKRequestSerializable then spreading out to every RestKit class that references it.
The first error is 'Expected a type' for the line:
#protocol RKRequestSerializable
then 'Expected selector for Objective-C method' for the line:
- (NSString*)HTTPHeaderValueForContentType;
then 'Expected a method body' for:
#optional
The first thing I did was revert the changes I had made since the last successful compile, but this made no difference. I then rolled RestKit back in case I had accidentally made a change, but this had no effect. I have tried deleting derived data, deleting and re-adding RestKit, but nothing has any effect. My project will not compile.
The strangest thing is that RestKit compiles successfully. The errors are from the compilation of my project. I've lost three hours on this so far and would greatly appreciate any input or suggestions as to how I might solve this.

Are you still building for the simulator? I've seen this behavior after an XCode crash. The Schema gets set to OS X 64 bit or something else and RestKit doesn't compile there.

Related

Xcode 9 Compiler Hangs On File With No Warnings Or Errors

Background:
Attempting to upgrade large 100k codebase from Swift 2.3 to Swift 4. Was making good progress, fixed ~1000 error. Then, after changing one of our DTO objects to use Any instead of AnyObject (because we had to), the compiler started hanging.
Problem:
When compiling the application will get to a certain file and just get stuck (even after 24 hours). It is not frozen just stuck compiling. I have tried temp removing the file but then it just gets stuck on another file and so on and so on.
Research & Attempts
I've read up on the compiler and how to turn on warnings and flags. I tried looking at -Xfrontend -debug-time-function-bodies and -Xfrontend Xfrontend -warn-long-expression-type-checking but nothing comes up. When I look at the build transcript for the file its stuck on there is no info in the expanded transcript.
Do you know what else I can check? I suspect it has something to do with its inability to infer type given how many Any filled dictionaries we have but without getting better information I have no clue where to go from here.
Do you know how I can get info as to why it's getting stuck on this file and no warnings given?
To followup, it took several days, but by first converting to Swift 3.2 and then Swift 4 (commenting out most code to solve later) I was able to get it to compile in Xcode 9.

XCode 7.2.1 - cdtool cannot compile occurs irregularly

The app I am developing has a weird issue since a few months. Sometimes during building an archive the error cdtool cannot compile occurs. But only sometimes.
When I wipe the derived-data and do a clean-archive it works again.
I found a variety of people asking similar questions, but they all had this error occur nonstop.
To be precise: The error occurs always during archiving and always on the same file which is Config.xcdatamodel. This CoreData model only has one version so version-conflicts aren't a problem (also verified on the file-system).
Unfortunately it is nearly not reproducable at all, it seems to occur 100% randomly. It also doesn't provide an closer information about what exactly it is, that fails.
In the image there are two compile-errors. Thats because the Config.xcdatamodel that fails, is in both targets. They won't be used at the same time, so it should be fine. I also suspect that the second error-message is based on the first (upper) one.
Did anyone ever observe such a behaviour? I'm currently using XCode 7.2.1

Build failed--attribute must have a defined type

My app crashes on build. Here's the error in it's entirety:
DataModelVersionCompile /Users/AAAAAAA/Library/Developer/Xcode/DerivedData/XXXXXXXXXX-envirswdnpegjccdpxakhoykfnfq/Build/Products/Debug-iphonesimulator/XXXXXXXXXX.app/WMMGDataModel.momd XXXXXXXXXX/WMMGDataModel.xcdatamodeld
cd "/Users/AAAAAAA/Desktop/Everything from DT 1:20:15/App projects/WMMG/XXXXXXXXXX"
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/momc -XD_MOMC_SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -XD_MOMC_IOS_TARGET_VERSION=8.1 -MOMC_PLATFORMS iphonesimulator /Users/AAAAAAA/Desktop/Everything\ from\ DT\ 1:20:15/App\ projects/WMMG/XXXXXXXXXX/XXXXXXXXXX/WMMGDataModel.xcdatamodeld /Users/AAAAAAA/Library/Developer/Xcode/DerivedData/XXXXXXXXXX-envirswdnpegjccdpxakhoykfnfq/Build/Products/Debug-iphonesimulator/XXXXXXXXXX.app/WMMGDataModel.momd
/Users/AAAAAAA/Desktop/Everything from DT 1:20:15/App projects/WMMG/XXXXXXXXXX/XXXXXXXXXX/WMMGDataModel.xcdatamodeld/WMMGDataModel 5.xcdatamodel:WMMGAccount.attribute: error: WMMGAccount.attribute must have a defined type
/Users/AAAAAAA/Desktop/Everything from DT 1:20:15/App projects/WMMG/XXXXXXXXXX/XXXXXXXXXX/WMMGDataModel.xcdatamodeld:0: error: Compilation failed for data model at path '/Users/AAAAAAA/Library/Developer/Xcode/DerivedData/XXXXXXXXXX-envirswdnpegjccdpxakhoykfnfq/Build/Products/Debug-iphonesimulator/XXXXXXXXXX.app/WMMGDataModel.momd/WMMGDataModel 5.mom'
Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/momc failed with exit code 1
The relevant part seems to be:
/Users/AAAAAAA/Desktop/Everything from DT 1:20:15/App projects/WMMG/XXXXXXXXXX/XXXXXXXXXX/WMMGDataModel.xcdatamodeld/WMMGDataModel 5.xcdatamodel:WMMGAccount.attribute: error: WMMGAccount.attribute must have a defined type
I've gone into my xcdatamodel, but can't find any attributes that aren't properly defined by type. One suspicious thing I'm seeing is the reference to WMMGDataModel 5. I'm up to version 8 in my model, and can't even find version 5.
This crash began after a recent automatic migration (using MagicalRecord) in which I added an attribute to one of the entities and then recreated the Managed Object Subclass (yes, the new subclass contains the new, properly defined attribute). I've added attributes before, but this is the first time I've encountered this issue.
I've cleaned the thing, quit and restarted Xcode, still crashes. Anybody have any ideas? I also deleted the DerivedData folder for the project. Still won't build.
Edit:
I just recreated all my managed subclass files. Still no dice--same error message.
Edit:
I tried running another project as a control, and got this message:
Unable to run app in Simulator
An error was encountered while running (Domain = FBSOpenApplicationErrorDomain, Code = 4)
So I quit Xcode and the simulator, restarted Xcode. Same error.
Yet more info
I restarted the computer and tried again, but am still getting "Build Failed" with the same error message.
If anyone else has run into anything like this, I sure would appreciate some guidance here... :)
Final edit
Please see solution in my answer below...
Ok, I finally cured the problem with a decision to delete my xcdatamodeld and rebuild the entire model. Some research into how to do this yielded a less destructive and less risky method in this answer.
Here's hoping it will help someone else with this problem.
Thanks to all who took a look!
I've never had the problem you describe, but have a few suggestions. Apologies if you've already tried these:
First, in the model editor, can you access the model version 5 that you suspect is the problem, eg.:
If it's there, you can hopefully fix the attribute error. If it doesn't appear there, have you tried right-click in the Project Navigator and select "Show in Finder":
Then in Finder looking for the version 5?

Why is XCode flaky about throwing duplicate symbol errors?

I have an XCode 6 project with two targets - an iOS 8 app and an iOS 8 extension. I share a constants file across both targets.
I made the mistake of declaring a const int without an extern or static prefix in the header, which resulted in the duplicate symbols linker error.
This erroneous declaration has existed for the past several revisions of the project, and the constants header has been included in MULTIPLE files since day one.
Why then, did I start getting the error only recently - after I made a change to the project file by removing the Main.storyboard - and that too ONLY on the simulator build?
Note: This has happened before
Further background on when the error started occurring:
I removed an unused Main.storyboard from the project file, and immediately after, started getting this linker error. I knew this error should not be occurring now, since the relevant constant had been used for ages.
I fixed the error anyway (by declaring the const as an extern instead), but now started getting some other errors.
I was now convinced there wasn't anything wrong with the code, and it was just XCode mucking up. So to test I ONCE AGAIN removed the Main.storyboard, and the weird errors (sorry I don't have a record) were back again, with zero changes to code.
To confirm further, I checked out a complete prior commit (which had worked flawlessly, and still had the Main.storyboard) on the same machine. This time, without any changes to the code, the project or Main.storyboard, I saw the same errors.
This confirmed that there wasn't any problem with my actual pbxproj and source files, but some problem in the data XCode had cached (somewhere).
Note that clearing the DerivedData folder didn't help either.
The roundabout point being, XCode definitely seems to be at fault whether for throwing the error suddenly or not throwing it all this while. But I'm checking if there could be another logical explanation for why XCode suddenly seemed to "change" its behavior.
Just check that you haven't #imported a .m file by mistake, instead of a .h. This has caused the duplicate symbol error for me in the past.

The FacebookSDKResources.bundle is no longer required for your application

Trying to integrate my app with Facebook for login proposes, i've happened to notice the following log line:
2014-01-07 15:22:08.843 Nutrino[7457:70b] FBSDKLog: The FacebookSDKResources.bundle is no longer required for your application. It can be removed. After fixing this, you will need to Clean the project and then reset your simulator.
The problem is FacebookSDKResources.bundle is not even existing in my FacebookSDK directory. So basically this log message is redundant for me.
Normally i won't care much, but this log message is popping into my log console 3 times in a raw each time i'm instantiating FBLoginView.
Been looking around and saw this answer which state that the guy is probably getting this error after having upgraded to a newer version of Facebook SDK. Unfortunately i'm not upgrading. I started a new project from scratch so i don't have any reference to safely remove from the app project.
Any suggestions? How can i get rid of these annoying log messages
Thanks in advance.
Gil
UPDATE
Ok - I've found out the source of the problem!!
I'm developing my app in xCode5.. Once in a while I open an older version of xCode with an older version of the app for some code references, so the problem happens when both projects are opened simultaneously.
The FacebookSDKResources.bundle does exists on the older version of the project and this is the cause!
Hope it'll helps someone.
original answer
I'm not really sure if this is what solved it, since I left it as it was for a while and the next time I checked those log messages weren't there, but the only thing I do remember changing was the fact the I made my FBLoginView instance a singleton, so there was only one instance of it.
Worth the shot if anyone is dealing with the same issue.

Resources