On Aug 30, 2015, at 11:40 PM, Quincey Morris < email@hidden> wrote:
On Aug 30, 2015, at 18:53 , Alex Hall < email@hidden> wrote:
The Readme states that I just add the Swifter.xcodeproj file to my project, add SwifteriOS or SwifterMac to the frameworks section of my project's build phases, and that's it. I've done both, but no matter what I try, as soon as I create a new instance of Swifter, I see "use of unresolved identifier Swifter" appear and the project fails to build.
I dunno, but the readme instructions are a bit out of sync with the current state of play with Xcode. It’s no longer necessary (at least in simple cases) to mess with the build phases directly, nor with target dependences.
Instead, select the app’s project item in the navigator, and display the General tab. Near the bottom, add the framework product to the Embedded Binaries list (I’m assuming you want the framework in your app bundle). I think this will automatically add to the Linked Frameworks and Libraries list, too, but if not you can do that manually. (It’s no longer necessary, supposedly, to do this second part at all if your app has ‘import’ statements naming the Framework, provided modules are enable in build settings, but it doesn’t do any harm.)
Done, thanks. As I said, I've never used frameworks before, so this is all new. The instructions I found on how to do this were all for older versions of Xcode, and I figured the process hadn't changed. Fortunately, after doing that and adding import SwifterMac to the file that uses it, the app… Well, it doesn't run yet, but it sees Swifter and is able to use it! Thanks for the help!
The next thing I would do is switch to the scheme for the framework, up in the toolbar, and build the framework, to make sure it builds without error. This also makes sure that the framework module actually exists — your original error may be that it’s never been built, so Xcode can’t find it to build the app. (Note that a target dependency wouldn’t help, if this is the problem, because Xcode can’t build your app, because it can’t compile the source file that imports your framework, because the framework module doesn’t exist yet, so I don’t think Xcode even gets as far as looking at dependencies.)
The framework did indeed build successfully, minus a few warnings about replacing variables with underscores. No error I could find, though, and the alert that appeared indicated success. This also taught me how to use VO to choose a new target in the toolbar, something I've never done before and which is, fortunately, accessible (if slightly confusing due to some odd labels).
If all is well, you should be able to switch back to the app scheme and build the app. If that still doesn’t work, I’d suspect a build setting that has turned off modules, or something like that.
The only oddity now is a warning about "multiple build commands for [path to project]". With all the mucking about I've been doing in my project settings, I'm not overly surprised to see I've caused a different problem. I'm not quite sure how to fix it, since selecting that warning in the Issues table doesn't open anything like code warnings open the relevant source file. Still, at least the framework is working, and this whole thing has been a great learning experience. The really weird part is that, if I go to the line causing the error and press cmd-ctrl-j, the relevant class in Swifter opens right up; clearly, Xcode can see the framework, or it couldn't jump to the source like that.
Don’t read too much into this. Because you added Swifter.xcodeproj to your workspace, it’s been indexed, so it’s not implausible that you can navigate using the functions that depend on indexing. That probably doesn’t depend on what’s actually built, in any important way.
|