Static library in Xcode 7 / iOS9 - static-libraries

I wrote a code to create a library named 'libHashUtils.a' in Xcode 7/iOS 9 and compile the code. But I am not able to figure it out where it is. It shows me in the Xcode as follows:
Please let me know the setting so that ti can get 'libHashUtils.a' in 'Products'

Related

Xcode 13: `Value of type 'NSPersistentCloudKitContainerOptions' has no member 'databaseScope'`

After upgrading to Xcode 13.0 (13A233), the following code that used to work with Xcode 12
let publicOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: containerIdentifier)
publicOptions.databaseScope = .public
produces the error: Value of type 'NSPersistentCloudKitContainerOptions' has no member 'databaseScope'
And indeed when I click on NSPersistentCloudKitContainerOptions it shows the old (iOS 13) version of CoreData framework without databaseScope.
My deployment target is iOS 14 and it used to work with Xcode 12 for a long long time. Also, it is now broken in several projects, including the ones that were created with Xcode 12, i.e. rather recently.
How to fix this?
Apparently, now it is required to import CloudKit as well to make databaseScope available in CoreData's NSPersistentCloudKitContainerOptions class.

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.

Xcode Beta 6 - Use of undeclared type 'CLLocationManagerDelegate'

I have just upgraded from Xcode 6 Beta 3 to Xcode 6 Beta 6. In Beta 3, everything worked fine and compiled like I wanted it to.
Right now, I cannot get CLLocationManagerDelegate to work, i.e. I always get the Use of undeclared type 'CLLocationManagerDelegate' - error message.
This is what my file looks like:
import UIKit
import CoreLocation
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, CLLocationManagerDelegate {
Additional info:
I have added the CoreLocation Framework (tried adding it within Xcode directly, also by drag-and-dropping the actual file from the folder, no changes)
I have had to reinstall Xcode 6 Beta 6 a couple of times before getting it to start (running OSX 10.9.4, always crashed on first startup)
As you can see, I import CoreLocation to my file.
CLLocationManagerDelegate does not autocomplete, it goes as far as CLLocationManager
Any ideas? I'm assuming something is not linked properly here.
Try to clean your build directory:
Product-->Clean
Product-->(Alt key) Clean Build Folder
Delete your derived data:
Window-->Organizer-->delete derived data
Another possible reason for the 'use of undeclared type' error is that your class is also within your test target, but the 'undeclared type' is not.
This was a bug in XCode. Was solved in Beta7/Xcode6.

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

Resources