Adding Sparkle framework in Xcode 4 - cocoa

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.

Related

CoreData codegen toolchain error with Xcode 8.1 [duplicate]

I am getting this error on generating an NSManagedObject in Xcode 8.1 in Swift.
:0: error: filename "DemoOne+CoreDataClass.swift" used twice: '/Users/Swasidhant/Desktop/demo again/DemoOne+CoreDataClass.swift' and '/Users/Swasidhant/Library/Developer/Xcode/DerivedData/demo_again-hiinrbwwbmyfbrbctsfdzvudkkuy/Build/Intermediates/demo again.build/Debug-iphonesimulator/demo again.build/DerivedSources/CoreDataGenerated/Model/DemoOne+CoreDataClass.swift'
:0: note: filenames are used to distinguish private declarations with the same name
:0: error: filename "DemoOne+CoreDataProperties.swift" used twice: '/Users/Swasidhant/Desktop/demo again/DemoOne+CoreDataProperties.swift' and '/Users/Swasidhant/Library/Developer/Xcode/DerivedData/demo_again-hiinrbwwbmyfbrbctsfdzvudkkuy/Build/Intermediates/demo again.build/Debug-iphonesimulator/demo again.build/DerivedSources/CoreDataGenerated/Model/DemoOne+CoreDataProperties.swift'
:0: note: filenames are used to distinguish private declarations with the same name
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
I searched for this and got answers saying the file might be present twice in the project which is not my case. Another solution I came across was to remove the file from the build phase and add again. That too didn't work. Is it some build setting configuration mistake ? Or something else?
Here is the link with a demo project created with Xcode 8.1 and showing this problem:- https://www.dropbox.com/s/xwyzhshktb2hqe7/demo2.zip?dl=0
The issue is happening because of the Xcode automatic subclass generation feature.
According to What's New In Core Data
Xcode automatic subclass generation
Xcode now supports automatic generation of NSManagedObject subclasses
in the modeling tool. In the entity inspector:
Manual/None is the default, and previous behavior; in this case you
should implement your own subclass or use NSManagedObject.
Category/Extension generates a class extension in a file named like
ClassName+CoreDataGeneratedProperties. You need to declare/implement
the main class (if in Obj-C, via a header the extension can import
named ClassName.h).
Class Definition generates subclass files named
like ClassName+CoreDataClass as well as the files generated for
Category/Extension.
The generated files are placed in DerivedData and
rebuilt on the first build after the model is saved. They are also
indexed by Xcode, so command-clicking on references and fast-opening
by filename works.
So for fixing your issue, you need to set the Codegen field value to Manual/None as shown below:
This is what I did to fix this issue,
Select your entity in the data model
Set the Module to Current Product Module
Leave the Codegen to Class Definition though Manual/None also works
Select Editor > Create NSManagedObject Subclass
May help someone, Go to project compile source delete the extra reference if any.
Select code data model then select the Entity change the value of 'Codegen' to Manual/None.
It will work.
The issue was due a second file named:"Extensions.swift" in my project.
After deleting the duplicate "Extensions.swift" the error got resolved. Your error message might tell you which file is duplicated.
In my case Data Model (as example: MyCoreData.xcdatamodeld) was listed twice under Editor -> Create NSManagedObject Subclass... And here was reason why it was getting this type of error.
What I did:
I did delete MyCoreData.xcdatamodeld file.
Created another Data Model as example MyCD.xcdatamodeld.
Checked is here duplicated Data Models in here: Editor -> Create NSManagedObject Subclass...
Clean and later build for two times.
It happened to me when I copied and renamed entity. It failed to rename the class, so do it manually.
I just restart my Macbook and that clean my build folder. And it works like a charm!

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.

Mac OS X: How to launch an application (.app) from a "Command Line Tool" type of app?

In Xcode 4.6, I created a new application based on the "Command Line Tool" project template.
How can I programmatically start another application (.app application bundle) from that "Command Line Tool" app?
There are numerous ways to accomplish this, using Launch Services and or NSWorkspace.
One of the more flexible ways to identity a bundled application is via its bundle identifier (CFBundleIdentifier), which is a string like com.apple.TextEdit. This allows you to identify an application without having to hard-code an assumed path where the application will be found, or by hard-coding the name of the application bundle, both of which a user could easily change. You can use NSWorkspace's launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier: to launch the app. If you don't already know it, you can obtain the bundle identifier of an application bundle by checking its AppName.app/Contents/Info.plist file. Then use the following code:
if (![[NSWorkspace sharedWorkspace]
launchAppWithBundleIdentifier:#"com.apple.TextEdit"
options:NSWorkspaceLaunchDefault
additionalEventParamDescriptor:NULL
launchIdentifier:NULL]) {
NSLog(#"launching app failed!);
}
Important: NSWorkspace is part of the AppKit.framework framework, which is not initially included in the "Command Line Tool" project template. To add it to your project, select the target in the list of targets like shown in the image below, and click the + button to add additional frameworks.
Add both AppKit.framework and Cocoa.framework.
That will result in all 3 being listed in the Link Binary With Libraries step. At that point, you can remove both the Foundation.framework and AppKit.framework from the linking stage, and leave just the Cocoa.framework, like below:
Have you tried "open"? At least in terminal "open" runs files and/or apps.

Dock Tile Plug-in not working

I'm trying to create a dock tile plugin.
I've added a new Target to my project with Wrapper Extension as docktileplugin
I've added a Class that implements NSDockTilePlugIn with method:
-(void)setDockTile:(NSDockTile *)dockTile
{
NSLog(#"DOCK TILE PLUG-IN LOADED!");
}
I've set this class as Principal Class in its info.plist
I've set this new DockTile Target as a Target Dependency for my main application and I've added it to "Copy Files / Destinantion: Plugins" Build Phase
I've set the NSDockTilePlugin keyword in my Main Application's Info.plist as the name of the Dock Tile Target without extension.
I've followed the documentation, and even downloaded the example program that apple provides located:
http://developer.apple.com/library/mac/#samplecode/DockTile/Listings/DockTilePlugIn_DockTilePlugIn_m.html
The example program doesn't work, but I at least get a console error:
12/20/12 8:29:49.217 PM com.apple.dock.extra: Could not load Dock Extra class from the bundle /Users/[MYNAME]/Downloads/DockTile/build/Release/DockTileApp.app//Contents/PlugIns/DockTile.docktileplugin
Please help.
After much trial and error, I discovered that you must have the following build configurations for your dock tile plugin to run properly.
Other Linker Flags: -ObjC
OS X Deployment Target: 10.6 or above, depending on your current OSX version
Architecture: Standard (32/64-bit Intel)
#gravityab After much searching I found an unmaintained version and I've now updated it, added another feature to the sample and put it on github here - https://github.com/CartBlanche/MacDockTileSample. Feel free to fork or submit PRs if anyone notices I've done something wrong.

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