Stripe API gives 'SenTestingKit/SenTestingKit.h' file not found - ios

I've read through the article referring to this in xcode 4.5, but it didn't help me in xcode 5.0.2.
I have a project that compiles successfully. If I add the Stripe framework to my project then it immediately fails to compile and gives me this file not found error for an #import made in this header file:
Stripe/Vendor/PaymentKit/PaymentKit Example/PaymentKit Test/PKCardNumberTest.h:9:9: 'SenTestingKit/SenTestingKit.h' file not found
I do not have the SenTesting framework in my link libraries. If I add it I get an error about it being an OSX library and not an ios. None of the Stripe documentation gives any indication that you need to add this library. I sent their support an email and they told me they don't have any information.
Anyone out there have any suggestions? Again, as soon as I add the framework to my project (and I am making sure it copies the files to my project) it fails to compile.
I tried adding quotes around my framework search paths, but it just changed the error so now Parse/Parse.h was no longer found.
The two framework search paths I have are: $(inherited) and /Users/ctam/Documents/development/Chw

See the Xcode 5.0 Release Notes:
Unit Testing
The CPlusTest unit testing framework has been removed
from Xcode 5. To write unit tests for C++ code, use the new XCTest
framework and create Objective-C++ (.mm) test case subclasses. 8273037
SenTestingKit and OCUnit are deprecated. Use the migrator to move to
XCTest. 14857574

When you download the Stripe library via the link in their documentation there are a bunch of subfolders for a test project they don't tell you about. I looked through and removed the test application files and everything works fine now. Curious that their explicit directions lead to this problem.

Related

Can't Use "Vendored Framework" CocoaPod Inside Workspace Playground

I've created a sample project illustrating my issue here.
In summary, I'm trying to use a "vendored framework" CocoaPod inside a workspace playground. I think this is possible but requires a bit of fiddling with project settings, and I can't quite figure out what to change.
To observe the issue in the sample project, do the following:
Open CocoaPods-Test/CocoaPods-Test.xcworkspace in Xcode.
Pods should be installed and committed in the repository, but can run pod install if necessary.
Note that the CocoaPods-Test target builds and runs successfully, importing PromiseKit and TwilioChatClient pods.
Navigate to Playground.playground within the workspace.
Note that the playground executes fine while importing PromiseKit but if TwilioChatClient is imported, playground execution fails with "no such module 'TwilioChatClient'".
After reading the following resources:
https://github.com/CocoaPods/CocoaPods/issues/5334
https://github.com/CocoaPods/CocoaPods/issues/5215
https://github.com/CocoaPods/CocoaPods/issues/5563
https://github.com/CocoaPods/swift/issues/3
https://github.com/CocoaPods/CocoaPods/issues/4135
https://github.com/CocoaPods/CocoaPods/issues/2240
https://github.com/CocoaPods/CocoaPods/issues/6669#issuecomment-300188519
https://guides.cocoapods.org/using/troubleshooting.html
https://www.objc.io/issues/6-build-tools/cocoapods-under-the-hood/
I think the issue is probably related to the fact that TwilioChatClient is a "vendored framework" (see its podspec), which means a pod target is not created for it. After reading the above resources, I feel like a solution is within reach, but I can't quite figure it out.
While the sample project here illustrates what I think is the underlying issue, the issue that prompted me to create this example project is just a small bit more complicated.
In my project, I create a framework target containing all my app's code (so it can be imported into my app and also into my playgrounds using app resources). This framework then has pod dependencies, including PromiseKit and TwilioChatClient. The execution error in the playground is different ("Couldn't lookup symbols" instead of "no such module"), as I am not importing the CocoaPods module directly but my framework which uses the pod framework.
I suspect if I can solve the "no such module" issue, it will help me solve my "couldn't lookup symbols" issue.
Finally, this seems like a good opportunity to make an open source contribution others don't seem to have wanted to do (see discussion here). Tangentially, I'd love to contribute but just don't feel like I understand what exactly is going on with CocoaPods, the Xcode build process, etc., after reading about it a bit (e.g. here and here). Any references to help understand the Xcode build process and what CocoaPods is doing under the hood are appreciated. It seems like the resources I've found are either "a very high level overview" (which I get), or "digging through the source code", with not a whole lot in between.
If you must have this work, I came up with a workaround by creating a framework target inside the Pods project which is named the same as the vendor framework, and uses all its headers publicly, using the framework as a sole dependency. I have forked your GH example and linked it here.
It's not the most elegant solution, but it will help you out in a pinch.
UPDATE
Build "fake" framework first, then build app target, then go to playground.

How to create custom cocoa touch framework with storyboard

I'm following this tutorial to create a custom framework. I have tried the source code as in that tutorial, excepts that when building the framework, I just select "Build Only Device>Generic iOS Device" and press Command+B, instead of using the build scripts introduced in that tutorial. It works fine for me with the source code copied from that tutorial.
After that, I tried to build my own framework with storyboard and build it like above, then try using it in a simple test app. The framework built successful but when I include it in the test app, it doesn't work. The error message is:
I am using the latest version of xcode and mac osx. My entire source code for both test application and simple framework is in this link. Please take a look and help me find what is going wrong. Thanks so much!
Solved
I just find out why. It seems like that is because I have opened both Test Application and the framework project in two workspaces. Closing the framework project before import it to the Test Application solve the problem.
Can you check target membership at right pane for this class?
Check all boxes if it is empty.

Adding a custom Framework to an Xcode project

I decided to try to make a Cocoa Touch Framework. Making it worked fine, but I am having trouble adding it to a project. After searching through a lot of SO posts and looking at Apple Forum threads I decided to try this from the Docs:
Add a framework bundle to a project in order to incorporate the
framework’s features into your product.
In the project navigator, select the project or group within a project
to which you want to add the framework.
Choose File > Add Files to “”.
Select the framework bundle, and click Add.
The frameworks you add this way are third-party-built bundles
containing the framework’s object code and runtime resources. See
related articles for information about linking to a framework without
adding it to the project.
After you add the framework, Xcode configures the targets in your
project to link them to the framework just added.
It still doesn't work. I am getting a No such module 'Scaffold' error for everything I try, I have checked spelling, but that is not it. Can someone explain how this works? I might just need clarification on how this is done.
Links I have looked at:
Create and import swift framework
Xcode error when I add a framework
Adding a framework to XCode 4
Xcode 5.1 compiler errors after adding a framework
Add a framework to an existing project without using cocoapods
What is the process for creating a Framework?
Hey I do not know if it is too late to answer this question, but due to the fact that I am facing same issues right know I would recommend you to check the Build Settings of the project where you import your framework
You should check the "Framework Search Path" and if the framework is at Swift and you import to an obj c project check YES to "Always embed swift standard libraries"
More or less the problem I think is in the Build Settings

Building a Swift Framework with Xcode 7 (Beta 3) to use as an Embedded Binary

Ever since Embedded Binaries were introduced in iOS 8, I have been wanting to port a lot of my common code into frameworks. I decided to wait one year before doing it and this year, with Xcode 7 Beta and iOS 9, I'm starting to do that just that.
I have started a Cocoa Touch framework project in Xcode 7 and I want to compile it into a usable framework. I can get it to compile my project into a .framework, but there's a few issues; namely, the framework doesn't appear to be importable into new projects (I will describe the steps I did for that shortly). Because of that, I'm not sure if my framework has any visible symbols.
This is what I have done to create the Framework:
Created my Framework as a Cocoa Touch Framework.
Went to my target's Build Phases, went to Headers, and added all my Swift files to the "Public" section, in hopes that will export all my simbols without having to mark them as public.
I tried to archive my project as a framework. Currently, it looks like Xcode 7 Beta 3 has a bug (going to report it later today) in which it generates corrupted archive files. For this reason I couldn't get my framework from the Organizer Window. To work around this, I changed the schema of the Run action in Xcode from Debug to Release, built it and grabbed it's generated .framework from my project's build/iphoneos-release directory. This was a quick test so I didn't need the frameworks generated for emulators.
And this is what I did to try to add the framework to a new project:
Created a "Frameworks" group (for organizational purposes) and dragged the framework there, selecting "yes" when it asked me if I want to copy the file to my project's directory.
Went to my target's settings, removed my framework from "Linked Libraries" (it was added there automatically), added it to Embedded Binaries instead. This added the framework to Linked Libraries again, so I had to remove it from there twice. Leaving the framework in Linked Libraries causes a linker error (can't find the framework - no idea why but I think it's irrelevant to my problem and something I should report to Apple as well), but once you remove it from there it seems to compile fine when you add it to Embedded Binaries.
Tried to import my framework in a file. Xcode complains there is "no such module".
Unfortunately, despite the fact that embedded frameworks have been around for around a year, I can't find much writing on the topic.
So my question is: Am I creating the framework correctly, making it possible that my framework/anything else is failing due to an Xcode 7 Beta bug? Or is there a different procedure to create a framework that I want to use as an Embedded Binary? I should probably mention that I want to make this library open source, and I think distributing a plain .framework file to the people who want to use it would be neat.
I Had the same issue on Xcode 7.
I solved it by editing the build settings of the project (the one which includes the framework).
By setting the Framework Search Paths field to $(PROJECT_DIR) or to the path to the directory that contains the .framework file it should help Xcode finding the module.

How to build iOS framework with XCode 6

I know of familiar tutorials on this, but introduction of framework XCode 6 template has changed the game.
I already watched WWDC 2014 video about building modern frameworks but it talks more about building extensions, framework & app all inside single project. It does not specify if the framework I make with it is truly reusable across any project.
I am building framework the XCode 6 way (File->New Project->Framework and Library->Cocoa Touch Framework), but when I import it inside my test app project (separate from framework project) - I keep getting various errors.
Example: Include of non-modular header inside framework, and so on.
I know this is not what it says, and there are quite some missing steps in whatever I am doing. The older tricks may have worked for everyone, but I simply don't find which way to follow after XCode 6.
For example, there is some folder structure that a framework needs, but XCode 6 doesn't comply to it while building it. Is it right? If not, how can I change the way the XCode builds framework folder hierarchy?
Do I go back to old school or am I screwing some tiny thing in XCode 6 that I am unable to create a reusable framework?
I am not sure if you are trying to build a framework with Objective-C or Swift as your question doesn't state it. I've encountered errors you are mentioning with Swift so I'll give you my method to build Swift frameworks.
I found the process for Objective-C to be very straightforward and well documented, so I'll skip this.
As for Swift, there are a few things to consider. First, Swift static libraries are not supported, so you must exclusively use a framework (aka dynamic library) when linking an app to a library.
Here are the steps:
Create the Framework using New > Project under IOS > Framework & Library, select Cocoa Touch Framework
To avoid the "ld: warning: directory not found for option..." goto Library Search Paths in Build Settings for your target and delete the paths.
You can't mix Objective-C with Swift so don't even consider adding the Swift-Header bridge file in your code.
There are some cases in swift where you need to import code from unexposed Frameworks. I've successfully used the module-map inside the framework to deal with these case.
I also select CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES in the Build Settings to solve 'include of non-modular header inside framework module'. That seems to work
I make sure that the header file that gets generated is marked as Public (not Project). Click on the file and you'll see the selection in the inspector under 'Target Membership'
You may run into some bizarre error messages when building. Xcode has a tendency to report linker errors when your code can't compile correctly resulting in missing files the linker needs to output its binaries. Sometimes XCode won't show the errors in the files you are compiling and you need to go manually on the build output and go back to the files. Some other time, you'll get a problem where you need to delete the cache. Those issues I call XCode blues and deal with it constantly. I found this type of problems happens more often when building libraries. The rest should work as expected.

Resources