Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

Detect invalid built Swift App #42

Closed
KrauseFx opened this issue Dec 1, 2014 · 8 comments
Closed

Detect invalid built Swift App #42

KrauseFx opened this issue Dec 1, 2014 · 8 comments
Assignees
Labels

Comments

@KrauseFx
Copy link
Collaborator

KrauseFx commented Dec 1, 2014

Related: #22 (comment)

@KrauseFx KrauseFx self-assigned this Dec 1, 2014
@KrauseFx KrauseFx removed their assignment Jan 7, 2015
@KrauseFx
Copy link
Collaborator Author

KrauseFx commented Jan 7, 2015

This looks really interesting, thanks @sinoru: nomad-cli/shenzhen#178

@DarthMike
Copy link

Hi, I've been testing submitting an app with Swift code and it has been rejected as discussed in #22. So I've tested using changes to Shenzen by @sinoru and the binary is not rejected anymore, delived by deliver 😃

@KrauseFx
Copy link
Collaborator Author

Wow, this is very great news, thanks for letting me know! When I add the dependency of the latest shenzhen it should work fine.

What would be even cooler: a warning from deliver itself, if it's not correctly bundled. What do you think?

@DarthMike
Copy link

A warning from deliver would be great; you may not want to use shenzen and the email from Apple is very cryptic.

@KrauseFx KrauseFx self-assigned this Jan 12, 2015
@KrauseFx KrauseFx changed the title Better Swift Support Detect invalid built Swift App Jan 13, 2015
@KrauseFx
Copy link
Collaborator Author

The binary can be extracted using

file.extract(tmp_folder)

And then it can detect whether the app uses swift:
otool -Iv myapp.app/* | grep _swift

which returns some error and some _swift in the resulting output.

@lvillani
Copy link
Contributor

The app bundle also contains some libraries prefixed with libswift in the "Frameworks" directory, maybe you could test for that. At least that's the case for my IPAs (whether they were produced by Xcode's Organizer or shenzen).

If this is true for all apps, then I guess that also inspecting the output of "unzip -l <path-to.ipa>" is fine (and you wouldn't even have to extract the archive somewhere).

E.g.:

↪ unzip -l ~/Downloads/PuliziaStrade.ipa | grep libswift
  6049088  01-25-15 21:08   Payload/PuliziaStrade.app/Frameworks/libswiftCore.dylib
   378624  01-25-15 21:08   Payload/PuliziaStrade.app/Frameworks/libswiftCoreGraphics.dylib
   112368  01-25-15 21:08   Payload/PuliziaStrade.app/Frameworks/libswiftCoreImage.dylib
   198928  01-25-15 21:08   Payload/PuliziaStrade.app/Frameworks/libswiftDarwin.dylib
   135056  01-25-15 21:08   Payload/PuliziaStrade.app/Frameworks/libswiftDispatch.dylib
  1067984  01-25-15 21:08   Payload/PuliziaStrade.app/Frameworks/libswiftFoundation.dylib
   173920  01-25-15 21:08   Payload/PuliziaStrade.app/Frameworks/libswiftObjectiveC.dylib
   111376  01-25-15 21:08   Payload/PuliziaStrade.app/Frameworks/libswiftSecurity.dylib
   135296  01-25-15 21:08   Payload/PuliziaStrade.app/Frameworks/libswiftUIKit.dylib
  6048720  11-17-14 19:16   SwiftSupport/libswiftCore.dylib
   378240  11-17-14 19:16   SwiftSupport/libswiftCoreGraphics.dylib
   112000  11-17-14 19:16   SwiftSupport/libswiftCoreImage.dylib
   198560  11-17-14 19:16   SwiftSupport/libswiftDarwin.dylib
   134688  11-17-14 19:16   SwiftSupport/libswiftDispatch.dylib
  1067616  11-17-14 19:16   SwiftSupport/libswiftFoundation.dylib
   173552  11-17-14 19:16   SwiftSupport/libswiftObjectiveC.dylib
   111008  11-17-14 19:16   SwiftSupport/libswiftSecurity.dylib
   134928  11-17-14 19:16   SwiftSupport/libswiftUIKit.dylib

In my experience, applications not packaged correctly still have the Swift runtime within the .app. They just lack the "SwiftSupport" directory.

And, anyway, both copies of the Swift runtime seem to have slightly different sizes and checksums, which is really weird (although the one from "SwiftSupport" seems to come from within Xcode.app).

@KrauseFx
Copy link
Collaborator Author

KrauseFx commented Apr 2, 2015

As there were no submitted issues about this recently, I'll close this issue for now. Thanks everyone for helping me with it.

@fastlanebot
Copy link

This issue was migrated to fastlane/fastlane#2453. Please post all further comments there.

fastlane is now a mono repo, you can read more about the change in our blog post. All tools are now available in the fastlane main repo 🚀

@fastlane-old fastlane-old locked and limited conversation to collaborators Mar 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants