Linker command failed error in AppDelegate because of Google Analytics - xcode

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.

Related

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.

How do I successfully add RealmSwift to Xcode?

I would like to add RealmSwift to an experimental Xcode project (for Mac OS X Yosemite) and have tried to follow the installation instructions on the Realm website.
I have downloaded the Swift version of Realm and dragged the framework to Xcode correctly.
I have set the Framework search paths to point to the new framework.
On trying to run, Xcode trips up with a code sign error, exit code 1.
I have not added anything else to a standard Xcode template / Cocoa (non-document) application using Swift and storyboards - its just a bog-standard appDelegate Xcode template at the moment without any added code other than the Realm framework. I have searched endlessly around SO and across the internet in general but most help out there concentrates on iOS.
I am using Xcode 6.3.2 build 6D2105 and OS X 10.10.4.
The error log looks like this:
Warning: usage of --preserve-metadata with option "resource-rules"
(deprecated in Mac OS X >= 10.10)!
/Users/bobavery/Library/Developer/Xcode/DerivedData/RealmTest-hffxikloaikapxcsotbcfqpezrba/Build/Products/Debug/RealmTest.app/Contents/Frameworks/RealmSwift.framework/Versions/A:
code object is not signed at all In subcomponent:
/Users/bobavery/Library/Developer/Xcode/DerivedData/RealmTest-hffxikloaikapxcsotbcfqpezrba/Build/Products/Debug/RealmTest.app/Contents/Frameworks/RealmSwift.framework/Versions/A/Frameworks/Realm.framework
Command /usr/bin/codesign failed with exit code 1
Any pointers would be very welcome!
i have this problem before.. and the documentation is working allright.. i think there something wrong on the way your adding the framework.. on a new xcode project.. Go to General.. Drag and Drop the framework on Embedded Binaries.. then add Run Script on Build Phases.. add also the path on Build Settings> Framework search paths like this>> $(PROJECT_DIR)/RealmSwift.framework/Frameworks add also other library needed for RealmSwift.... On the project make sure your import is RealmSwift.

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.

iOS 8: How to properly setup extension to debug it in Xcode using simulator?

I've followed the documentation that Apple provides for debugging extensions and I'm still unable to debug an extension, so for example, breakpoints are not being picked up.
I've created a new target for the extension, that created a new scheme and I've configured that scheme to launch the correct app when running my extension.
The extension works fine but debug things like NSLog or breakpoints are not working. I also tried answers like this but they are not working
I'm using Xcode 6 beta 5 and iOS simulator
In addition to this answer https://stackoverflow.com/a/24043265/1136433 which says how to view logs of the extension app, in that log you can also check the PID of the extension.
Let's say you have the following NSLog statement:
NSLog(#"Testing");
Execute the extension and in the system.log you will see something like this:
Sep 11 11:13:40 my_machine.local today[5689]: Testing
Where 'today' is the name of the extension you are executing (in my case was a Today Extension) and the '5689' is the extension PID.
So, now you can go to Xcode -> Debug -> Attach to Process and then you can set breakpoints and debug the code.
Hope this can help somebody

RestKit error when testing iOS application on device

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.

Resources