简体   繁体   中英

Use Swift Pods in Objective C project

Currently, we are working on a project, which is developed purely using Objective-C language. For some reason, We had to use POD projects as dependency in our project. One of the POD project is developed using Swift language. So we have created bridge to use swift file in objective c classes.

So now, when we run this app directly onto device in debug mode it works perfectly. But when we try to deploy this app with Enterprise Distribution, it installs into devices but its not opening. When ever we click on app icon to open application it gets crashed. We have checked device logs as well. Its shows problem in loading libraries which are derived from POD projects.

We have searched through many forums and websites for this concern. They all suggested that due to changes in structure of dependency in POD files this issue is occurring.

For ex.: Before iOS 8 POD projects was attached to app as a static library with ".a" extension. But from iOS 8 and Swift 2.0, this projects are included as dynamic frameworks with ".framework" extension.

We have tried many solutions but its not working. We have also regenerated our distribution certificate as iOS 9 had some changes in certificate fields. But still its not working.

So i want to ask is that, Can we use Swift POD projects in Objective C Project? What should be the root cause for this issue? Do swift 2.0 have part in it?

Please suggest some solution/workaround for this problem.

Swift dependencies can only be imported by CocoaPods as embedded frameworks, where you specify use_frameworks! in your Podfile, and this requires that your App's iOS deployment target is set to 8.0 or higher.

If you need to support iOS 7, the only way you can use the Swift Pod is to remove that Pod dependency and directly add all the files of that Pod to your App's project.

I have solved this issue!!

To fix this issue, you will need to sign your app using code signing certificates with the Subject Organizational Unit (OU) set to your Team ID. Apple made changes to their certificates so you'll need to create a new certificate before signing your app.

Please follow these steps to fix the certificate issue:

  1. Revoke the distribution/developer certificate
  2. Create a new distribution/developer certificate
  3. Update the corresponding profile with your newly created certificate
  4. Archive your app again with the new certificate

This has solved issue for me but its still not working in my mac pc.When i generate build from any other Mac pc then its working fine. So i think there might be problem related to my XCode and Mac Pc key chain certificates and profiles.

Hope this may Help you!!.

:D

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM