RestKit error when testing iOS application on device - xcode

I am receiving a lot of "sematic issue" errors when trying to test my iPhone application after installing my provisioning profile from Apple.
It has worked perfectly during the development period, however since I set up my provisioning profile, each time I try to build I receive the errors below (80 when my physical device is selected and 10 when using simulator):
RKRequest.h: error: Semantic Issue: Redefinition of 'RKRequestMethod'
RKRequest.h: error: Semantic Issue: Redefinition of enumerator 'RKRequestMethodPOST'
...
I retrieved the version of RestKit from its git repository about a month ago and it has been working perfectly until now.
Here is a sample from the error detail:
In file included from /Users/nick/Library/Developer/Xcode/DerivedData/MyApp-
bpcvkhxzjupqmibdvvipchdfecpi/Build/Products/Debug-
iphoneos/include/RestKit/CoreData/../ObjectMapping/../Network/RKClient.h:21:
I have tried clearing this directory but the problem persists and have included a screenshot below:
Here's an example of how RestKit is used in the app:
MyViewController.h
#import <RestKit/RestKit.h>
#import <RestKit/CoreData/CoreData.h>
#interface MyViewController : UIViewController<RKObjectLoaderDelegate, MFMailComposeViewControllerDelegate, UIActionSheetDelegate, SelectTranslationDelegate>
...
MyViewController.m
#interface MyViewController()
{
}
#end
...
#implementation MyViewController
...
My Linked Libraries
Does anybody have any suggestions as to why this might be?

From the screenshots and our chat conversation i can tell you are using an outdated version of RestKit. Recently, they significantly simplified the build process and submitted a number of iOS5 fixes so the update is worth it.
run git pull in the RestKit directory
remove #import <RestKit/CoreData/CoreData.h> from your files. Just #import "RestKit/RestKit.h" should do the trick
Remove all RestKit libs from "Link Binary With Libraries", be sure to add new libRestKit.a and libxml2.dylib
Try building the project, if you see any errors try removing derived data in Organizer.

As a starter, check your project 'Build Phases' in Xcode and make sure you have't got more than one entry for each of the RESTKit .m files (or a stray .h), in the 'Compile Sources' list.

Related

iOS Swift how to debug SIGABRT :"fatal error: call of deleted method" from a CocoaPod?

I have an app which uses SlideMenuControllerSwift. I've modified some code to see how to present different panels, then rolled back my changes.
When running the project I get SIGABRT fatal error: call of deleted method in console when SlideMenuControllerSwift is initializing. No other error messages are given.
The project's source control appears to be in exactly the same state as before
changes.
I did a "clean"
Reinstalled pods.
Deleted pods directory and made a clean install
Deleted app from device and ran again
Did a fresh checkout into a different folder
Updated cocoapods gem
Even modified the function to use self.addLeftGestures()
How do I debug an issue caused by cocoa pod throwing "fatal error: call of deleted method"?
UPDATE: seems like something is seriously broken with the functions inside that pod, calling another function within init causes bad access exception:
In my case, I had created a project scheme that uses the release build configuration:
In this configuration, if your project build settings does not allow testability in this release mode then setting custom breakpoints or app crashes do not let you debug properly and you are served the fatal error: call of deleted method
Solution:
Check the project build settings for "testability".
Ensure it is "Yes" for the build configuration you are testing under.
In my case, I temporarily enabled testability for Release by making it Yes.
For anyone seeing this error using SwiftUI on XCode 11.4 and trying to access a property on an ObservableObject subclass eg.
class Model: ObservableObject {
#Published var name = ""
}
class ModelSub: Model {}
let model = ModelSub()
// This line causes `fatal error: call of deleted method` on XCode 11.4
$model.name
// Instead do
model._name.projectedValue
See more details here

Debug view hierarchy in Xcode 7.3 fails

This function fails with runtime error:
-[UIWindow viewForFirstBaselineLayout]: unrecognized selector sent to instance 0x7fb9dae257d0
Anybody encountered the same?
UPD:
Fails on simulator iOS 8.1/8.4. 9.3 works fine.
UPD2:
UIWindow is created like:
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.rootViewController = RootViewController.rootVC
window?.makeKeyAndVisible()
I got the view debugger working again by placing the following fix in my project:
#ifdef DEBUG
#import <UIKit/UIKit.h>
#import <objc/runtime.h>
#implementation UIView (FixViewDebugging)
+ (void)load
{
Method original = class_getInstanceMethod(self, #selector(viewForBaselineLayout));
class_addMethod(self, #selector(viewForFirstBaselineLayout), method_getImplementation(original), method_getTypeEncoding(original));
class_addMethod(self, #selector(viewForLastBaselineLayout), method_getImplementation(original), method_getTypeEncoding(original));
}
#end
#endif
When your project loads, the load method will execute, causing viewForFirstBaselineLayout and viewForLastBaselineLayout to use the viewForBaselineLayout implementation if they are not currently implemented, so view debugging gets iOS8 flavor the behavior it was looking for.
To add this to your own project, create a new empty Objective-C file in your project and paste the contents in. You can name it whatever you want. I call mine "UIView+FixViewDebugging". If you are in a pure Swift project you do not need to create a bridging header. The file will be compiled into your project and you don't need to reference it.
Note this will only work for debug builds because of the #ifdef DEBUG. You can remove it but then you may accidentally compile this into your release builds (though it should have no ill side effects). If this method isn't working with these lines, check that your target has DEBUG=1 in Build Settings > Apple LLVM - Preprocessing > Preprocessor Macros > Debug.
Looks like Xcode 7.3 uses viewForFirstBaselineLayout property to draw the UI. But this property is marked as available since iOS 9.0.
[UIView viewForFirstBaselineLayout] method should be used for the version prior to iOS 9.0. It seems the guys from Apple didn't consider this case.
Yes. when click the debug view hierarchy button ,the page has nothing, and print "[UIWindow viewForFirstBaselineLayout]: unrecognized selector sent to instance 0x7fb9dae257d0" .
To solved it, just be sure you are using the iOS systom not below iOS 9.0 and you will still use that function freely.

Linker command failed error in AppDelegate because of Google Analytics

I'M trying to integrate Google Analytics to my Xcode project. I've added obj-c classes by using bridging header and then I've set some options in AppDelegate. After AppDelegate commands I got the following errors. How can I solve that one?
Note: Xcode recognises GAI class.
Error causing code:
GAI.sharedInstance().trackUncaughtExceptions = true
GAI.sharedInstance().logger.logLevel = .Verbose
GAI.sharedInstance().dispatchInterval = 20
GAI.sharedInstance().trackerWithTrackingId("UA-XXXXXXX-Y")
Errors:
Quick fix(works for me) - Delete the 'Google Analytics' references,not "remove to trash" option from your project navigator, and add them again. Should work out
I just forgot to libGoogleAnalyticsServices.a file.

LaunchServices: no bundle found with identifier new.myApp.com While launching app

I am working on an app where I did code signing for the app and got bundle identifier. I added bundle identifier in .plist file of project and also in App Targets under general settings. But when I run app in simulator, It prints in log
LaunchServices: no bundle found with identifier new.myApp.com
I tried to add bundle identifier in .plist again, but still shows
same thing. I'm getting lots of problems because of this issue (e.g
Unable to integrate login with Facebook functionality). I don't know whats
the reason for this. If anyone has any solution, Please suggest me. Why I'm getting this LaunchServices: no bundle found with identifier.
Any help will be appreciated.
if you have removed storyboard file then adding your custom viewcontroller to window.rootviewcontroller.
Make sure you have removed storyboard file from plist and from general also.

Adding Sparkle framework in Xcode 4

I'm totally stuck in a operation that might be really simple...adding Sparkle to a project created in Xcode 4.
I did these operations :
Added Sparkle.framework to my project (drag&drop)
Added to "link Binary With Libraries" but it generated this error:
dyld: Library not loaded: #loader_path/../Frameworks/Sparkle.framework/Versions/A/Sparkle
Referenced from: /Users/me/Library/Developer/Xcode/DerivedData/MyApp-esurnmkwvxcgcxbbrdgsobkoimfv/Build/Products/Release/Myapp.app/Contents/MacOS/MyApp
Reason: image not found
Removed to "link Binary With Libraries"
Added to "Copy Bundle Resources"
Add an instance on SUUpdater to mainMenu.xib
Did every config step required (create the private Key, upload file and rss etc..)
When i launch my application i get a warning :
Unknown class 'SUUpdater', using 'NSObject' instead. Encountered in Interface Builder file at path /Users/...etcetcetc
And obviously due to this warning the updater never starts. What I missed?
You also need to import the Sparkle framework into the header file for your class:
#import <Sparkle/Sparkle.h>
#implementation YourClass : NSObject
{
}
This isn't mentioned in your question as one of the steps you've taken, hence I'm assuming it hasn't been done.

Resources