UPDATED with answer at bottom
I am using the TwitterKit framework as installed with Twitter's new Fabric platform. This code in ViewController.swift
works just fine:
//
// ViewController.swift
// Following
//
// Created by David Aragon on 12/4/14.
// Copyright (c) 2014 David Aragon. All rights reserved.
//
import UIKit
import TwitterKit
But this code in a custom Swift file I made called TwitterAdapter.swift
fails:
//
// TwitterAdapter.swift
// Following
//
// Created by David Aragon on 12/10/14.
// Copyright (c) 2014 David Aragon. All rights reserved.
//
import Foundation
import TwitterKit // Error: No such module 'TwitterKit'
I made sure to add TwitterAdapter.swift
to all my targets when I created it. Here are some screen shots to illuminate the directory hierarchy:
UPDATE:
Solved with the latter portion of Kampai's answer. Here is the part that got it all working:
Again right click on the project name and click on Add files to
"project-name" >> Select TwitterKit.framework bundle and click on Add
button will add a reference of that framework to project.
Here I have tried to add this framework in application and its perfectly working. From this it is clear that issue is related to linking with the module you have added.
Relink / Reference again with the module will resolve this issue:
Points need to be highlight:
- Copy the framework to project application folder.
For example:
Go to finder of its location >> From Xcode right click on project name >> Show in finder will open project location folder. Here you must have to copy TwitterKit.framework
bundle.
- Again right click on the project name and click on Add files to "project-name" >> Select
TwitterKit.framework
bundle and click on Add button will add a reference of that framework to project.
I had a same error with Xcode 7
Helped to uncheck and then check again a checkbox field standing for linking the broken framework in the target membership section
I was facing the same problem. My project was swift based and there were no objective C code. I wanted to add 3rd party framework and on import facing same error "no such module". I solved it by adding a bridging-header file in swift and just import framework there. It works for me.