No Such Module "AirshipKit" when doing import AirshipKit in Swift

I have a project in Swift. I am using 7.3.1 Xcode. I would like to enable my app for use with Urban Airship. 

I created the app in the Urban Airship and followed the instructions quick start TO THE LETTER. Here is what I did

  1. Downloaded 7.3 Urban Airship SDK
  2. Copied over Airship and AirshipKit folder into the Xcode project as instructed.
  3. Copied over the AirShipKit.xcodeproj into Xcode as instructed.
  4. Added AirshipKit.framework to Embedded Libraries
  5. Made Sure that "Enabled Modules (C and Objective C)" and "Link Frameworks Automatically" are set to yes.
  6. Imported "AirshipConfig.plist" into the project as instructed.
  7. Since this is Swift project, I can't add "#import <AirshipKit/AirshipKit.h>" to AppDelegate.m so I added "import AirshipKit" to AppDelegate.swift. This is how it's done in the sample Swift project included with the SDK

Here is where all the problems start. Xcode editor highlights this line and says that "There is no such module ArshipKit"  

What is stranger is that the on one Mac sample project does not display the error and project builds. On the same Mac, my project displays the error at first, but when I build the project the error disappears and project builds. As the matter of fact I was able to send some test messages to iPhone running my project.

On another Mac with the same OS and Xcode versions, both sample project included with 7.3 SDK and my project display the  "There is no such module ArshipKit" at line "import AirshipKit" in AppDelegate.swift and both projects won't build due to this error.

I tried latest 8.3 SDK. This one is even worse. Sample project won't even build due to TON of errors. I enclose screen captures.

Please help. 


 

...

Didn't find what you were looking for?

New post

Comments

47 comments

  • Hi Nicolas,

    It looks like you're building an app for iOS 10, is that correct?

    If you are planning on supporting iOS 10, please try updating to the latest library version (8.0.0) as that will have support for iOS 10.

    Once you have done that, clean and rebuild both AirshipKit and your project, and let's see what Xcode says after that.

    0
  • I am building against 9.3 iPhone. The Xcode project is set to compile against 9.3 device. Xcode is 7.3.1 and MacOSX is 10.11.6.

    I tried 7.3 and 8 Urban Airship SDK.

    I can send you a my project so you can take a look at it. 

    I can't even get SDK 8 to compile the sample project against ANY target. The third image I uploaded is what I get when I try to compile it.

    0
  • Nicolas,

    Are you on the latest version of Xcode as well?

    If you are, let me know. I'll send over an invite to upload your sample project so we can take a look at it.

    0
  • Please let me know how can I send you the sample project.

    0
  • Nicolas,

    Just sent you an invite to upload your files. Go ahead and upload there and I'll take a look.

    0
  • I uploaded a simple test app that simply tries to include Urban airship SDK and do nothing else. 

    0
  • Nicolas,

    I was able to build the project successfully on my end.

    I did note that I had to do the following:

    1) Convert the project to use Swift 3

    2) Make sure the code signing is specified on both the project and the Airshipkit project

    3) Build Airshipkit first, then build the entire project.

    I've uploaded my version of your project, could you give that a shot?

    For reference, I am currently on Xcode 8 and using Swift 3.

    0
  • No change. I can build the project you send me on my desktop Mac, but on my laptop Mac, 'No Such Module AirshipKit' error persists. 

    Why two different behaviors on two different Macs? I checked, both Macs have the same OS and same Xcode.

    0
  • Nicolas,

    It could be a caching issue on the laptop itself.

    I'm sure you've already cleaned and rebuilt the project (and if you haven't, go ahead and do that), but what you might do is exit Xcode completely, then delete the ~/Library/Developer/Xcode/DerivedData/ModuleCache folder. You may consider deleting that entire DerivedData folder if you wish.

    0
  • I just did as you suggested. I cleared the cache folder and cleaned the project. No change. 

    I tried creating Objective C test project on my laptop. Objective C project builds on my desktop and fails on my laptop just like the Swift project. 

    I even tried to clean project and emptying the cache again. Still no good for both Swift and ObjC test projects.

    This is seriously strange... Am I the only person who had this problem?

    0
  • Nicolas,

    Do you know if this same build error happens if you build either of the Sample apps included with the library?

    0
  • I can build ObjC and Swift samples that come with SDK 7 on my desktop.

    I can't build them on my laptop. I get the error that AishipKit can't be imported into AppDelegate, no such file. 

    The only major difference between my  laptop and desktop is that laptop is 2010 vintage and desktop is 2015. They have same version of OS and Xcode. I don't use any software that hooks into OS that might cause problems. My Macs are as plain vanilla as possible.

    0
  • I have the same problem

    0
  • Nicolas,

    Hmm...That's very very odd.

    Alright, desperate times call for desperate measures.

    Let's go ahead and completely uninstall/remove Xcode from your laptop, and redownload the latest version and install Xcode Tools. It'll take awhile, but we'll give it a shot and see if that does it.

    0
  • We got new Mac Mini. I tried building on this Mac. No problems, so we have more than one Mac on which we can build..

    I need to get our app into app store asap, so I will work on this this week.

    I will go back to diagnosing this problem later.

    0
  • Nicolas,

    No worries! 

    Let me know when you're ready to tackle it again. I'll be here :)

    0
  • @Ben

    Have you tried the any of the steps I laid out previously, and did any of those work to resolve the issue?

    0
  • I tried clearing the cache and cleaning the project. Re-installing Xcode takes a long time. 

    I will try this tomorrow, I am almost done making our App Airship compliant.

    In case you are interested, I installed Xcode not from app store, but from DMG file downloaded from Apple on both Macs.

    0
  • Nicolas,

    That should be fine as long as it was downloaded from https://developer.apple.com/download/ (Which, I'm assuming it is)

    0
  • That's where I got Xcode from. I would never download any software that was not from an 'official' source.

    I am now researching how to 'reset' Xcode. I will try this tomorrow when I bring the bad laptop to work.

    0
  • I found the solution to the problem.

    • Start Xcode and open Xcode preferences.
    • Select 'Locations' icon
    • Click on 'Locations' tab
    • Click 'Advanced'
    • Build location should be 'Unique'
    0
  • Nicolas,

    Good to hear! Glad you got it to work :)

     

    0
  • Hm. I thought I'd just try to get the SwiftSample app up and running - but same deal on that. Generates a whole mess of errors. From your list of suggestions above, which is the one you'd recommend? 

     

    0
  • Ben,

    As a first step, you'll want to make sure code signing is turned on for the AirshipAppExtensions project. Then, you should be able to build the AirshipAppExtensions from there and that should resolve some of the errors, at least.

    0
  • I am having the same issue as Nicolas. I have followed the setup guide word for word and still get the error "No such module 'AirshipKit'". I was somehow able to  fix this error on a previous project that I did but now I can't seem to solve the problem. The previous project is running on the last update for version 7 of the SDK and everything worked fine. I am currently using XCode 8 and have the target set for ios10. 

    0
  • Rudy,

    Have you already tried to build the AirshipKit project before building the entire project altogether?

    0
  • Michael, 

    I was able to build AirshipKit by itself with no errors.

    0
  • Rudy,

    Okay, great!

    So, AirshipKit is building at least.

    Could you post a screenshot of how you have everything laid out in your project, similar to what Nicolas posted?

    Or, are you simply building with the Sample app?

    0


  • 0
  • Rudy,

    When you added AirshipKit to your project, did Xcode prompt you to create Folder References at all?

    If so, we want to choose "Create groups for any added folders". I know that has messed up some builds before in the past.

    0

Please sign in to leave a comment.