Closed JSchaenzle closed 8 years ago
Strange. Can you take a look at this example project: https://github.com/spark/spark-setup-ios-example
as a reference on how to use the SparkSetup lib - maybe you've done something wrong. let me know if that works for you
The example project works (although I had to replace all the println calls with print to compile it with xcode7).
I've been comparing the items in the Build Phases between my project and the example and I noticed that the example project contains a bunch of items under the 'Copy Bundle Resources' section including fonts and the main storyboard. When I look at my project I don't have any of the same items listed in that section, except for a LaunchScreen.xib. I have other images and things that I added to my project.
Do you know how those items got added to that build phase? I would assume that it's supposed to be taken care of by Cocoapods. Do you know what would cause the the resources to not be added for me?
One other question. I have been trying to use Carthage more and more for dependencies. Do you know if the SparkSetup library can be built as a framework and imported using Carthage instead of Cocoapods?
Oh by the way, I also had to change the angle brackets around the header files to quotes, in SparkSetup.h, in order to compile my project. Not sure if that is also telling of a setup problem...
PODFILE
running pod install
and then re-adding it and running pod install
again - I found that it solves those kind of issues usually. Be sure you have the latest cocoapods version (gem install cocoapods
)I've been running into the same issue but have fixed it for myself. One of the problems is that in my Swift project, I've turned on CocoaPods use_frameworks!
to enable the use of some external Swift libraries. Because of this, the bundle isn't properly located (see the announcement for CocoaPods 0.36 where this change was made: http://blog.cocoapods.org/CocoaPods-0.36/)
I'll have to verify that this is the change that fixed the problem (I've messed with the setup code a bit now trying to get it to work), but you can change [NSBundle mainBundle]
to [NSBundle bundleForClass: [self class]]
and ensure that the "Copy Bundle Resources" Build Phase of the SparkSetup framework includes (turns out this is not needed).SparkSetup.bundle
so that the actual bundle is found
Once I've done reproducing the issue with a minimal project, I can submit a pull request.
Just wanted to say I discovered this same thing earlier tonight. I removed use_frameworks! from my Podfile and that fixed the issue. Mine is also a swift/obj-c project but I'm actually not using Cocoapods to pull in any frameworks (I'm using Carthage for that) so it looks like I don't need the use_frameworks! flag.
I am glad to hear you fixed this though. Thanks!
PR merged, thanks!
Is there a demo of this working?
I can get my project to build and go on a device, but I cannot successfully create an archive with use_frameworks!
.
When I try to create an instance of SparkSetupMainController the following line throws an exception:
NSBundle *bundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"SparkSetup" withExtension:@"bundle"]];
The exception seems to indicate that the bundle is nil. `-[NSBundle initWithURL:]: nil URL argument"``
I am using Cocoapods to load the Spark-Setup dependency. I have tried using the latest released cocoapod (0.3.2) and the head of master and have the same problem with both.