关于MOJiThemeKit框架使用Bundle作为资源包时上传APP会报错(ERROR ITMS-90166/90171)的解决方案

由于MOJiThemeKit框架访问的资源包是采用Bundle的方式,而在整个开发过程中并没有不适。偏偏到了上传APP的时候,报了一堆错误,如下(这里举例几个错误提示):

ERROR ITMS-90166: “Missing Code Signing Entitlements. No entitlements found in bundle ‘com.moji.MOJiThemeCustomBackground’ for executable ‘Payload/MOJiDict.app/Frameworks/MOJiThemeKit.framework/MOJiThemeCustomBackground.bundle/MOJiThemeCustomBackground’.””

第一时间Google了“ERROR ITMS-90166”,被告知要把bundle文件夹下的info.plist文件内部的”Executable file”参数移除掉,如图:

需要移除箭头指向的参数和其对应的值

“ERROR ITMS-90166”问题得以解决。

ERROR ITMS-90171: “Invalid Bundle Structure – The binary file ‘MOJiDict.app/Frameworks/MOJiThemeKit.framework/MOJiThemeCustomBackground.bundle/MOJiThemeCustomBackground’ is not permitted. Your app can’t contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure.”

“ERROR ITMS-90171”该问题直接Google还看不出具体的解决办法,后面再细看内容说明,他依然强调可执行文件,所以在打包后,直接进入对应的bundle下面找内部文件,发现,其确实存在可执行文件(这里我就不贴图了)。

猜想:直接在build项目的时候把bundle的可执行文件删了不就OK了?

经过Google后,找到解决方案:找到对应的target,然后在Build Settings里面搜索“Versioning System”,如图:

把“Versioning System”的值设置为”None”即可,如图:

MOJiThemeKit里有7个bundle都要设置,重新编译并打包,“ERROR ITMS-90171”问题得以解决。

Facebook keyHash 生成

最近收到 Facebook 官方反馈,说是 google play 下载的 apk facebook 登录失败,一脸懵逼!测试本地的一切正常,后面怀疑多签名的缘故,亲自下载了 google play 商店发布的 apk,登录果然失败。

google play 商店发布的 apk 当初使用的是官方建议的签名【万恶之源】,然后就弄出了多套签名的故事,并且手里面只有一个 public 证书。

Facebook keyHash 生成按照官方 demo:
keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

如果只有一个签名,并且自己有 jks 之类的就很简单了,只需要敲以上命令就可以拿到结果值
因为 google play 商店只提供 public 证书,并且提供签名的 MD5、SHA1、SHA256
于是只能通过 SHA1 直接生成:
echo 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 | xxd -r -p | openssl base64

可以通过以上两种方法输出结果相互印证,最后当然要实际环境测试一下。
最终通过直接下载 google play 商店 apk 能够通过 facebook 授权。

https://stackoverflow.com/questions/54274593/how-to-compute-key-hash-for-facebook-from-deployment-cert-der-file