iOS app validation problems: non-public API usage, libsqlite usage - ios

Once I tried to validate my iOS application on the appstore, I got the following error on XCODE:
Your app contains non-public API usage. Please review the errors, correct them and resubmit your application.
The error doesn't provide an explanation on which are the non-public classes that we used. How can I get it?
The app references non-public symbols in Payload/...app/libsqlite3.0.dylib: _dispatch_sources_type_vm, guarded_close_np, guarded_open_np
I have tried to solve the problem by removing libsqlite3.dylib from xcode and by adding linker flag '-lsqlite3' or '-libsqlite3' (with the last flag the app did not compiled).
How can I solve it?

You could also just download the sqlite amalgamation and include the sqlite source code into your app. That would not link to the system libsqlite3.0.dylib and the problem would be avoided. Your app binary would get a little bit bigger, but the build/validation problems would go away.

Related

iOS Embedded Framework with Embedded Framework

I'm working on a framework which embeds another framework (from CocoaPods) for error logging on iOS. This is working very well, and I can embed such a framework in an iOS application for testing, codesign everything, and debug on my own device easily. Unfortunately, when attempting to upload such an application to Apple for distribution, I get an error message as such:
Invalid Bundle. The bundle at '<myapp>.app/Frameworks/<myframework>.framework' contains disallowed file 'Frameworks'. With error code STATE_ERROR.VALIDATION_ERROR.90206 for id ***
I'm not sure if this message indicates that I'm not allowed to embed a framework in another framework or what. It seems the automatic codesigning Xcode is doing is not recursing to the deepest embedded framework upload (I have a script to manually sign everything on build). Does anyone have experience with an error like this or know where to look? It seems others have asked questions about embedding frameworks in other frameworks before, but most of these are how to get linking to work or how to properly reference these nested frameworks. My issue is specifically if I am allowed to upload such things to test flight/the app store, and how to do so if it is possible. Most people having this issue seem to have disabled swift support, but none of the projects I'm using have swift code.
Nested bundle cannot include a framework. You can check this apple document.
iOS and tvOS support frameworks and Swift system libraries at the topmost app level; a nested bundle, like an app extension, can’t include a framework.
And there is a warning block that worth being noticed:
If you put content in the wrong location, you may encounter hard-to-debug code signing and distribution problems. These problems aren’t always immediately obvious. For example, when building a Mac app, incorrectly placed code might work during day-to-day development, but might cause problems during notarization.
So that is the reason everything seems normal while running in debug mode but failed at distribution.

Non-public API usage : The app contains one or more corrupted binaries

I am really frustrate whats going on with iOS application new version uploads. Here are the story.
On the date of 25th Jan 2018 we have uploaded new version 3.3.27 build number 1.0. That successfully process and available on test-flight for testing. After that we found some issue and on 26th Jan 2018 we fix it and uploading new build 1.1 and we get email from iTunes Connect said:
Dear developer,
We have discovered one or more issues with your recent delivery for "appname". To process your delivery, the following issues must be corrected:
Non-public API usage:
The app contains one or more corrupted binaries. Rebuild the app and resubmit.
If method names in your source code match the private Apple APIs
listed above, altering your method names will help prevent this app
from being flagged in future submissions. In addition, note that one
or more of the above APIs may be located in a static library that was
included with your app. If so, they must be removed.
If you think this message was sent in error and that you have only
used Apple-published APIs in accordance with the guidelines, send the
app's nine-digit Apple ID, along with detailed information about why
you believe the above APIs were incorrectly flagged, to
email#apple.com. For further information, visit the
While i am validate build before upload its success:
While i am uploading app i get following success:
In mail i did not get proper information what's the name of corrupted binary or framework. What is the method we used that non-public we have uploaded 100s update build of that application before 25th Jan everything is good and acceptable.
Then i have try following changes:
Rebuild app and submit again get same email.
Uninstall Xcode9.2 and Install again get same email.
Remove changes and upload build number 1.0 again get same email.
Change Mac and try to upload new build again same email.
Try to upload old version that live before and again same emai
We sent an email to iTunes Connect Review but since 3 days we did not get any reply from them side. I do research and from 26th Jan many user face that kind of issue while submit application.
If any one know that solution who face that kind of issue in past or recently Please help us
After a LOT of investigations on this part we finally found the problem for this issue:
It seems like Apple gives this error for applications that suport both 32 and 64 bits.
Apple gave this reminder for Mac Appstore, but it seems that iOS applications are affected as well.
So a solution for this is to support bitcode OR to drop support for 32 bit devices by removing support for ARMV7 and ARMV7S or bellow from Valid Architectures from build settings. This will mean your application will work only on iPhone 5S and above.
I hope this helps someone.
Thank you and happy coding!
There is not one solution for this issue Apple not mention anything now a days about that errors or invalid binary related news on their official account or forums or their official Developer site. Even they are not reply of your email.
Some of get that issue solved by BitCode enable, Some of solve that issue for update PODFILE, Some of Solve that issue by remove some old swift framework used in project.
But finally I get solution by my self that works for me. When i build the project i found some warning at left side panel of Xcode like following.
I think apple now removed old swift support so in case your project use any swift class or podfile we need to update to swift 4.
Once i conversion to swift 4 i get following warning:
The use of Swift 3 #objc inference in Swift 4 mode is deprecated.
Please address deprecated #objc inference warnings, test your code
with “Use of deprecated Swift 3 #objc inference” logging enabled, and
then disable inference by changing the "Swift 3 #objc Inference" build
setting to "Default" for the "appname" target.
For fix this warning i use following link The use of Swift 3 #objc inference in Swift 4 mode is deprecated? and in swift class i used #objc before public declaration.
Also i review all the source code and remove unused library of podfile and class from project.
by above way i fix that issue and after uploading 13th of build finally that accepted.
The non-public API refers to Apple API methods that are not documented and offered to the programmer.
Apple does not guarantee that this part of the API will work in future upgrades. They can freely change this part.
They forbid usage, so that your app won't break in iOS updates, and so protect your future users/buyers of your app!
The webservice is external, hence does not fall under non-public. This part you need to guarantee, not Apple.
In Target -> Build Settings -> Other Linker Flags, remove -interposable. Rebuild app solved the problem.
We found 2 solutions for the issue. Remove 32 bit support, which was referred above. And remove CommonCrypto usage. We replaced CommonCrypto by CryptoSwift (https://github.com/krzyzanowskim/CryptoSwift).
We chose to replace CommonCrypto as we didn't want to loose our 32 bit users (iPhone4S, 5 and 5C).

XCode Project Invalid Bundle on App Store Upload

When submitting our app to the app store the validation process for the build keeps getting rejected with the following error.
Invalid Bundle - One or more dynamic libraries that are referenced by your app are not present in the dylib search path.
Has anyone else had issues with this error? I feel like I've tried just about everything. I'd done the suggested otool -L on the main app as well as the watch app. The only library that it shows linked for is the Mixpanel library. The only other two libraries we are using is Fabric and Crashlytics. From my understanding those are not actual real frameworks? I've also tried to set ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to YES as many posts online suggest. The project builds and runs fine so I'm completely lost as to how to resolve this issue.
This is a React Native iOS app if that has anything to do with it. I'm not the most experience when it comes to iOS stuff but I can find my way around xcode. Anyone have any suggestions? Maybe the best solution is to just create a new xcode project and set everything up again and copy/paste in the code from the previous project?

iTunes crash logs with "dyld message: Library not loaded..."

I've received a crash log in iTunes for:
Dyld Message: Library not loaded: #rpath/Foo.framework/Foo
There are several of these, each for a different framework that is included in the app, although there isn't one for every framework.
I understand what a "library not loaded" crash means, and how to fix one that is happening on every run of the app - it's just "add the framework to copy files, because you forgot to before". My impression is an app should either crash with this error every time it is run, or none of the times it is run - either the framework is included in the bundle, or it isn't.
A few more details:
I can't reproduce this, and the vast majority of users seem to be getting along fine.
There are crash reports for both workspace (normal "Copy Files") and Carthage (carthage copy-frameworks) frameworks.
What should I do to investigate and fix these crashes?
This appears to happen when the device itself runs too low on memory. It's an iOS bug that should be fixed in iOS 9.3.2 (released May 16, 2016). The users that experience have many apps crashing for them during launch. The only way they can solve it is by restarting their device.
The issue is caused by apps using too many (third party) Frameworks. So you can either remove Frameworks (by for example copying third party code into your project) or wait for users to get the iOS update with the fix.

This app references non-public selectors ... base64EncodedString dataFromBase64String

I am getting this warning when submitting an iOS binary to Apple:
"This app references non-public selectors in Payload/x.app/x: base64EncodedString, dataFromBase64String"
I do not get a warning during the build in xCode.
I am using xCode 5.0.2 and Phonegap 3.3.
I don't know if Apple will reject the binary for this reason, but I don't want to wait to find out. Also, I like to resolve all warning errors the "right" way.
I have found other people having similar issues (different third party libraries) and it seems their solution is to get updated third party libraries. I am already using the latest phonegap and there has been plenty of time for this to have been resolved, so I suspect this problem is unique to something I am doing.
I have greped by project and the two symbols are referenced here:
Cordova/NSData+Base64.h:+ (NSData*)dataFromBase64String:(NSString*)aString;
Cordova/NSData+Base64.h:- (NSString*)base64EncodedString;
My two questions are:
1) Will Apple reject this binary because of this warning?
2) How can I resolve this warning message the "right" way?
I am answering my own question....
Upon further investigation we determined the problem was that we only
included libCordova.a in the project. This worked okay when testing
in simulator and on device, but gave the above warning on submission
to the appstore.
The solution to avoid the warning on submission was to copy all the
source code for libCordova.a into /platform/ios. That source code
originated from the "cordova create" command.

Resources