Can iOS 12 app extension write to Healthkit - ios

When first released, docs stated that Healthkit could not be accessed from app extensions:
For example, in iOS 8.0, the HealthKit framework and EventKit UI
framework are unavailable to app extensions.
WatchOS 1 also could not access Healthkit, but that changed with WatchOS 2
Does anyone know if that restriction is still present in current versions of iOS? The name of one API call and one SO post give me hope, but still unclear if that only applies to WatchOS extensions.
Can't find any clear statement, specifically looking for use in intents/Siri Shortcut functionality. Only looking to write data, not read.

Extensions have been able to use HealthKit since at least iOS 10.0 and watchOS 3.0.

I have a similar situation. I have my app with a widget. I tried to use 'import EventKitUI' in one of my swift file in the main app. Now, if I check mark the target membership to include my widget, it won't work. I would get error "Could not build Objective-C module 'EventKitUI'" Once I removed the check mark, everything works just fine.
Don't know the reason behind this but it is just I found out.

Related

AVFAudio Framework not present on macOS causes warning for iOS app (app should also be available on AS Macs)

My iOS app uses the AVFAudio framework to provide spoken feedback to the user while running. I would like this app to also run on Apple Silicon Macs (where the spoken feedback is not really necessary).
However, just importing the framework results in the following warning email after I upload to App Store Connect:
We identified one or more issues with a recent delivery for your app,
"App Name" 7.0 (24). Your delivery was successful, but you may wish to
correct the following issues in your next delivery:
ITMS-90863: Apple silicon Macs support issue - The app links with
libraries that are not present on Mac:
/System/Library/Frameworks/AVFAudio.framework/AVFAudio
I guess that this means the app will not be able to run on Macs.
How should I get this app to use the AVFAudio framework for iOS and still be available to run on macOS (AS Macs) with or without the framework on macOS?
Relevant code is:
import AVFoundation
class Speaker {
var speechSynth: AVSpeechSynthesizer
class func establishAudioSession() {
do {
try AVAudioSession.sharedInstance().setCategory(.playback, options: [.interruptSpokenAudioAndMixWithOthers, .duckOthers])
try AVAudioSession.sharedInstance().setMode(.voicePrompt)
try AVAudioSession.sharedInstance().setActive(true, options: [])
UPDATE / CLARIFICATION:
Note that my project does not include multiple targets. With multiple targets, this would be fairly straightforward. I am wondering if there is a way to achieve this by taking advantage of the newer AS Macs’ ability to run apps built for iOS without a separate target.
Is this possible when using this framework?
UPDATE 2:
I have submitted a support request to Apple for this now and their first suggestion was replacing
import AVFoundation
with
import AVFAudio
and then re-uploaded to App Store Connect, but after trying this, I get the same warning email back again. Will post an update (or hopefully an answer) when I hear back from them again.
I suppose your project has multiple targets defines (i.e. one for iOS and one for macOS). In the "General" tag of your target settings you can select which frameworks should be included under "Frameworks, Libraries and Embedded Content". Add your library for iOS, remove it for macOS.
If you share the same code you between apps you can also conditionally exclude some of it for macOS.
#if os(iOS)
// iOS only code
#endif
However, just importing the framework results in the following warning email after I upload to App Store Connect:
The problem probably isn't importing, but (as the message you got indicates), linking to AVFAudio, that's the problem. So solve that, you should select your app target in the Xcode project and go to the Build Phases tab. Look at the Link Binary with Libraries line and hit the disclosure button at the beginning of the line to reveal all the libraries that are linked into your app. Find AVFAudio and change the setting (there's a popup on the right side of the line) from Required to Optional. That'll let your app link to the framework if it's there, but still run if it's not.
But wait, you're not done yet... What do you think will happen if your app tries to actually use a framework that's not linked in (because it doesn't exist on the machine)? You'll get a crash, of course. To avoid that unhappy fate, you'll need to check for the existence of the framework before you use it. For example, you could do something like:
if NSClassFromString("AVAudioPlayer") != nil {
// do your AVFAudio stuff here
}
Further follow up from Apple support suggested the following:
Change back to import AVFoundation
Reduce the deployment targets from the latest and greatest back down to something less recent.
So I did both of these, changing the deployment targets from iOS 14.5 and macOS 11.3 to iOS 14.1 and macOS 11.0.
This has resolved (or worked around!) the issue.
I do want to deploy to the latest and greatest target for this particular app, so I don't consider it to be a complete solution as yet, but it will do as a work around for now. (I actually want to deploy to 15.0 when it's available to make use of the promised improvements to OSLogStore.)
So this sounds like a bug to me, and I have queried Apple for some further information on the issue, in particular, the ability to target more recent OS versions.

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).

Objective C generated interface header file Not found in WatchKit

I am currently working to add Apple Watch app in my current App. I added the required profiles and got it to working without any issues.
Now, I want to use some of the class files from iphone app in my apple watch app. I did add the .m file in the target membership to the watchkit extension target.
Since the file which I want to use is in Objective C class, I went ahead and created the bridging header file for apple watch extension target.
Each time when I run the application; I get $(SWIFT_MODULE_NAME)-Swift.h file not found. I did try to follow steps from this link but to no avail. I did clean build folder; removed the derived data but it still gives me the same error.
Am I missing anything in particular which others have tried and can share with me ?
I am using Xcode 8 and Swift 3.
So I figured out the answer and thought of posting it here.
There are couple of ways in which you can fix this but it depends on what you want to do.
1) Using #IF TARGET_OS_IOS will allow you to use the class from iphone to watch.
2) You can also use WatchConnectivity framework to send and/or receive messages, send data also. This is the new framework Apple has recommended to use for connectivity between the devices.
Hope this will help someone else trying to figure out this problem.

Will Parse working correctly if I set StoreKit's status to optional in Build Phases

I would like to use the Appirater library in my project, but after reading its install tutorial one thing is not clear.
Be sure to change Required to Optional for StoreKit in your target's
Build Phases » Link Binary with Libraries section.
If I set the status of the StoreKit framework to Optional from Required, will this affect anything that is related to my Parse implementations? Because the Parse iOS SDK also requires StoreKit. Or switching to Optional means the framework will be loaded when it's needed only and don't have any side effects so Parse will also work properly? Am I right or it's not easy like that?
I would really appreciate if somebody could give me some guidance, thanks.
tl;dr It doesn't matter. Optional or Required are effectively the same for StoreKit in 2015.
Setting a framework to be Optional is essentially telling the system "Don't crash this app if you can't find this framework on the iOS device you are running on". StoreKit was introduced a long time ago in iOS so it's very unlikely that there are still devices with iOS versions before 3 (when StoreKit was introduced).
The only reason the Appirater instructions say to set it to Optional is because at the time those instructions were written, there were still a lot of iOS devices out there with versions of iOS that didn't have StoreKit, and Appirater could run without it, so there was no reason to crash the app over it. Thus, the instructions say to make it Optional.
That said, I should just simplify the Appirater setup and #import StoreKit in Appirater.h so nobody has to deal with that anymore.

Improper IDFA usage, Apps contains IDFA but app is not respecting the Limit Ad Tracking settings in iOS

Please see attached all frameworks I have referenced in my project. Still I get this Limit Ad track settings failed validation error. Could someone please suggest me which framework might be responsible or what may I need to do. I am just stuck and have been struggling for last 1 days :( . Thanks for your help!
I have
Tapjoy
facebook
adsupport
libFlurry_4.4..0.a
iad
uikit
frameworks in my code. If I remove ADsupport, mygame fails with message that it needs for running on ios 6.0, although I am targeting for ios 7.0 as deployment target. Any help is greatly appreciated. thanks
Apple changed their IDFA scanning procedures recently. Not only do you have to check the appropriate checkboxes after you click on the "prepare for upload", but your code (or any other third party library that you have must use IDFA by using the class directly.
Someone suggested to do this:
"you can do that by replacing direct refs to ASIdentifierManager with NSClassFromString(#"ASIdentifierManager")"
DO NOT load this class using this approach! New scanning procedure will look specifically for this and if it is found instead of direct references - Apple seems to assume that there is some strange usage of the tracking identifier. I can't say I disagree with that decision.
It may not be easy to find exactly which library is at fault. Latest AdMob SDK for example is using the class directly and is NOT the source of a problem.
One way you can find out which library is the source of the problem is to remove AdSupport.Framework from your project and see which libraries fail to link. Those libraries are NOT the problem. See if you have other advertising libraries that do not require you to include AdSupport.Framework - those are most likely the culprit.
It sounds a bit counter intuitive, but the direct referencing is not the problem, dynamic (weak) loading of that class is.
My guess is that Tapjoy is the culprit since I did use the latest Flury and iAd without issues.
Hope this helps you - we were pulling our hair out for a few days before we figured it out.
grep for ASIdenfierManager on the folder of your project
in that way I found ASIdenfierManager in the libGoogleConversionTracking library

Resources