3

I'm updating my project to Swift 1.2

What has been done so far (changes from working project):

  • Updated Xcode to 6.3
  • Updated Alamofire to 1.2.0
    • Added it to Podfile
    • Added use_frameworks! to Podfile
    • Changed platform in Podfile 7.0 to 8.0
  • Updated Stripe 3.0.0 -> 3.1.0

I also fixed some issues in my code (mostly changed as to as! for castings).

After that PaymentKit (it wasn't updated) stopped loading its image assets (backgrounds, card images etc).

I've checked in derived data - PaymentKit.framework contains all assets inside it. But code like [UIImage imageNamed:@"mastercard"] returns nil. I spent couple hours trying to solve it - no luck...

Any Ideas what can be reason for that?

UPDATE

I found the reason - use_frameworks! flag But I don't know how to leave this flag (it's required by Cocoapods as Alamofire is a Swift Pod) and have working PaymentKit. The only reason I can see right now - is adding Alamofire using git submodule or just incorporate it's course to my project.

OgreSwamp
  • 4,602
  • 4
  • 33
  • 54

1 Answers1

7

I think the problem here is that this pod is "not ready" to be a framework. They use imageNamed instead of

NSBundle(forClass: self.class()).pathForResource("amex", ofType: "png")

you can still get this images from your code this way

let image = NSBundle(forClass: PTKView.self).pathForResource("amex", ofType: "png")

The "dirty" workaround now is just import all resources from this pod to you image assets or just copy it in the main bundle.

Sergnsk
  • 3,305
  • 3
  • 23
  • 28