简体   繁体   English

迁移到xcode 7可可豆荚库后停止工作

[英]After migrating to xcode 7 cocoa pods libraries stopped working

Recently new ios and xcode appeared so I decided to update to have a latest version. 最近出现了新的ios和xcode,所以我决定更新为最新版本。 First of all migration manager popped out and left many syntax errors. 首先,迁移管理器弹出并留下许多语法错误。 But after one hour I fixed them all. 但是一个小时后,我将它们全部修复了。 App compiled and it was a disaster. 应用已编译,这是一场灾难。 I use several external libraries (written in objc) using cocoa pods. 我使用可可豆荚使用几个外部库(用objc编写)。 They mostly don't work now. 他们现在大多不工作。

I'm using facebook image picker to get images from facebook - doesn't work, same for instagram image picker. 我正在使用Facebook图像选择器从Facebook获取图像-不起作用,对于instagram图像选择器也是如此。 As of my code also now ALAssets aren't working - well partially they are - I'm just not getting posterImages of groups and thumbnails of all photos. 就我的代码而言,现在ALAssets也无法使用-它们在一定程度上是有效的-我只是没有得到所有照片的组和缩略图的posterImages。 I can see correct amount of photos just thumbnails are all nils now. 我可以看到正确数量的照片,只是缩略图现在全部无效。

There are more problems. 还有更多的问题。 Sometimes back button in navigation controller is not appearing. 有时导航控制器中的后退按钮没有出现。 Anyone maybe I'd be able to fix that errors of 'my' code, but there's no way I'd fix all issues in these external libraries (especially in such a short time). 也许任何人都可以修复“我的”代码中的错误,但是我无法修复这些外部库中的所有问题(尤其是在这么短的时间内)。 I thought only swift will be impacted, but objc libraries are also under attack. 我以为只有迅速会受到影响,但是objc库也受到攻击。

So is there an issue with some cocoa pods settings or just libraries will no longer work? 那么某些可可豆荚设置是否存在问题,或者只是图书馆将不再起作用? I heard there's no way to use swift 1.2 in xcode 7. So I decided to downgrade back to 6.4. 我听说无法在xcode 7中使用swift 1.2。所以我决定降级到6.4。 App compiled without any problem (after cleaning up derivedData). 应用程序编译没有任何问题(清理了DerivedData之后)。 In simulator (ios 8.4) works like a charm. 在模拟器(ios 8.4)中,它就像是一种魅力。 But on device with ios9 all the same issues are present. 但是在带有ios9的设备上,所有相同的问题都会出现。 No photos thumbnails from gallery etc :) 没有来自画廊等的照片缩略图:)

Anyway there's one more thing. 无论如何,还有一件事。 My app has to offer similar functionality to the one client has sent me few weeks ago. 我的应用程序必须提供与几周前发送给我的一个客户端类似的功能。 I may be unexperienced in ios programming, but this app isn't working as well! 我可能没有ios编程经验,但是此应用无法正常运行! No photos from gallery :) And it's from appstore. 画廊中没有照片:)它来自appstore。 It looked very professional. 看起来很专业。 I smell serious changes under the ios 9 hood. 我在ios 9引擎盖下闻到了严重的变化。

So I don't think it's something wrong with swift 2.0 - it's an ios itself. 因此,我认为Swift 2.0没什么问题-它本身就是ios。

I fixed all the problems! 我解决了所有问题! I just want to say they were not related to migration from swift 1.2 to swift 2.0. 我只想说它们与从Swift 1.2迁移到Swift 2.0无关。 Going one by one: 一一走:

  1. nil thumbnails from ALAssetsLibrary - not sure why this was happening, but I restarted device and problem never came back. 从ALAssetsLibrary中没有缩略图-不知道为什么会这样,但是我重新启动设备,问题再也没有回来。 So good advice is to check if they're not nil (as I did). 因此,好的建议是检查它们是否不为零(就像我一样)。

  2. Not working instagram and facebook libraries. 不能使用instagram和facebook库。 Well first of all there's nothing wrong with cocoa pods. 首先,可可豆荚没有任何问题。 Reason of all this mess is App Transport Security. 所有这些混乱的原因是应用程序传输安全性。 I had to add this to Info.plist file (last one not related to facebook/instagram): 我必须将此添加到Info.plist文件中(最后一个与facebook / instagram不相关):

http://pastebin.com/rWgyiKXH http://pastebin.com/rWgyiKXH

You simple have to add all servers that app connects. 您只需添加应用程序连接的所有服务器。

  1. Not working back button - well that was a problem with my storyboard. 无法使用后退按钮-嗯,这是我的故事板的问题。 I had many push segues, but every viewController was embeedded in navigationController. 我有很多推送请求,但是每个viewController都嵌入了navigationController中。 That worked on ios8, but not on ios9. 在ios8上有效,但在ios9上无效。 I had to get rid of them and left first one and ones that were appearing by replace segue. 我必须摆脱它们,并留下第一个和那些替换塞古出现的东西。

No need to downgrade :) 无需降级:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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