App search results not showing up in spot light iOS - ios

I implemented App Search using CoreSpotLight framework. The results are still not showing up in iOS spotlight
The approach i followed is
Created CSSearchableItemAttributeSet with title, keywords and contentDescription
Created CSSearchableItem with above created attributes set.
Added the CSSearchableItem to CSSearchableIndex
Every thing seems to be correct, not sure why the results are not showing up..

Finally managed to find the issue,
The simulator ( iPad Retina 9.3 ) which i was using, is not supported for core spotlight. We can find the unsupported devices names in apple docs
Although app search is available for iOS 9 users, the search functionality of NSUserActivity and Core Spotlight is not supported on iPhone 4s, iPad 2, iPad (3rd generation), iPad mini, and iPod touch (5th generation).
Also,
The following code was throwing an error
[[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:#[item] completionHandler:^(NSError * _Nullable error) {
if (error) {
NSLog(#"Error :%#",error);
}
}];
The log is Error : Error Domain=CSIndexErrorDomain Code=-1005 "(null)”, which means CSIndexErrorCodeIndexingUnsupported , Indexing isn't supported on this device.
Hope this save time for someone.
Edit
As #rmaddy suggests, check for CSSearchableIndex isIndexingAvailable, this straightaways help to find the issue.

Related

Google AdMob is not working in Xamarin Form iOS for larger screen devices like iPhone 7 and 7 Plus

I am working on an iOS app using Xamarin Forms platform. I am using Google AdMob and implemented it following this URL http://motzcod.es/post/154696375922/xamarinforms-google-admob-ads-in-ios
It works perfectly fine on every device and simulator with iOS version as 10.2
It also works with iOS version 10.3 but only on fewer devices like iPhone 5s and 5c but not on devices and simulators for iPhone 6, 6s, 6s Plus, 7, 7 Plus
Debugging it further throws following error, "Error Domain=com.google.ads Code=13 "Request Error: Received invalid response." UserInfo={NSLocalizedDescription=Request Error: Received invalid response., NSLocalizedFailureReason=Request Error: Received invalid response.}"
I searched for this error and applied a fix too but that did not work as well.
I appreciate if someone could please help. Thanks
just FYI I followed this blog http://motzcod.es/post/154696375922/xamarinforms-google-admob-ads-in-ios
BannerView is used in the custom renderer of iOS like this
adView = new BannerView(size: AdSizeCons.SmartBannerPortrait,
origin: new CGPoint(0, UIScreen.MainScreen.Bounds.Size.Height - AdSizeCons.Banner.Size.Height))
{
AdUnitID = bannerId,
RootViewController = GetVisibleViewController()
};
Instead of creating its object using parameterized constructor, just create it like this
adView = new BannerView()
{
AdUnitID = bannerId,
RootViewController = GetVisibleViewController()
};
Above implementation fixed the issue in all the iOS Versions and Devices.
You may want to try App Transport Security and add the following lines to the Info.plist.
<key>NSAppTransportSecurity</key><dict>
<key>NSAllowsArbitraryLoads</key>
<true/></dict>
This may resolve your problem.

Call directory extensions won't run on iPhone 5 but will on all other device types

I've got 3 iPhone 5, 2 iPhone SE, 2 iPhone 6, an iPhone 6+ and an iPhone 7.
I've found that my app which uses a call directory extension won't work on any of the three iPhone 5 devices but there's no problem with it working on the other 6 assorted devices.
In case there is some problem with my app, I created a new app with a call extension which was created entirely using the XCode project templates (the Xcode call directory target template creates a lot of boilerplate code which is fully functional and will run and work without further change).
I got the same results - the template app also does not run on any of the iPhone 5 but it does run on the other 6 devices.
The conclusion from this would appear to be that for some reason call extensions don't work on an iPhone 5, however this is not a correct assumption because I downloaded an app from the app store (Hiya) which uses call extensions onto an iPhone 5 and there were no similar problems with its call extension.
So it is a mystery to me why both my app and the Xcode template app both do not work on any of my iPhone 5 but they are fine on every other device.
And that therefore is my question - has anybody encountered a similar situation or has any speculation why they don't work on iPhone 5?
(Was there an architecture change after iPhone5 and the build settings of the call extension might need changing to get it to work on the iPhone 5 for example?)
The way my app and the Xcode template app fails on the iPhone 5 is the same
1) the extension does not appear in Setting | Phone | Call Blocking & Identification. This implies it may not have installed/registered with the OS properly, however I don't see any problems being logged by the OS in the console when looking at the OS logging.
2) The status of the extension cannot be queried on an iPhone 5:
let theExtension = CXCallDirectoryManager.sharedInstance
theExtension.getEnabledStatusForExtension(withIdentifier: "com.redacted.redacted.CallDirectoryApp.TheCallExtension") {(enabledStatus, error) -> Void in
if let err = error as? NSError
{
print ("\(err.code) \(err.localizedDescription) \(err.localizedFailureReason)")
}
}
The error is err NSError domain: "com.apple.CallKit.error.calldirectorymanager" - code: 1
Again this might indicate the problem is related to the extension not installing.
(The problem is independent of the version of iOS 10 used on the iPhone 5, its the same result with a few versions of both beta and non beta versions. All devices are registered on the provisioning portal)
The iPhone 5 is 32 bit and everything else is 64 bit. I changed Xcode's default settings for the extension to the following and it now works:

HealthKit requestAuthorization dialog not appearing

I have been consistently unable to get the HealthKit requestAuthorization dialog to appear. This has been the case for two different phones with different OS versions and different installation methods (see below). The requestAuthorization code is standard boilerplate code, such as:
HKCharacteristicType *genderType = [HKObjectType characteristicTypeForIdentifier:HKCharacteristicTypeIdentifierBiologicalSex];
[self.healthStore requestAuthorizationToShareTypes:nil readTypes:[NSSet setWithObjects: genderType, nil] completion:^(BOOL success, NSError *error) {
NSLog(#"requestAuthorization completion block");
}];
I've tried a fresh app with just that code, tried different parameters for the requestAuthorization method call, and have tried resetting our systems in a number of different ways: app uninstall, resetting settings, erasing phone content and setting with existing partial backup; erasing phone content and settings with a full backup, erasing content and settings and starting phone as a new phone. Have tried multiple different readTypes and shareTypes. Each time requestAuthorization is called on a fresh app install, the following error code appears:
"Error occurred = Error Domain=com.apple.healthkit Code=4 "Missing
com.apple.developer.healthkit entitlement." UserInfo=0x7fa748534b00
{NSLocalizedDescription=Missing com.apple.developer.healthkit
entitlement.}"
However, the HealthKit entitlements are set in both Capabilities on xcode as well as Capabilities in the App ID on Apple Developer: Certificates, Identifiers, and Profiles.
- Questions: How do I fix this issue so the requestAuthorization dialog appears? What is a possible cause of phones getting into a state where they get this error consistently?
- Phones used: iPhone 6, iPhone 6 Plus
- OS Versions used: iOS 9.0 / 9.0.2 / 9.1 / 9.2
- Methods of loading app onto phone: iOS App Store, Watch App App Store, TestFlight, xcode
- Situations where this appears to not be broken: With our users' (non-development) phones installing via the App Store.
A few things could be causing this. First, your provisioning profiles could be out of date with what you are actually seeing on the web portal. Try refreshing these manually from XCode.
Does your app have an app extension or watchOS app that uses the HealthKit framework? Each of extension/watch app will have their own profiles on the web portal, and if the HealthKit framework has been added to any of them without having the entitlement added as well then this could also cause the error.

Current User nil after kill app on iOS 7

I am coding an iOS app with parse SDK. I check user logged in by
[PFUser currentUser] != nil
This is my case (on iPhone 5s, iOS 7.1):
Open app.
Login by account on parse database.
Logged in success, with currentUser != nil
On main screen (after login) I press iPhone's home button (2 times).
I kill the app
I open the app. And it not logged.
I debug and see PFUser currentUser is nil when open app second time.
I check it when the app is killed by user, and open again. It works fine on iOS 8, but when I check on iOS 7.1, currentUser is nil. It looks like it logged out automatic or currentUser did not save.
I am using parse SDK 1.7.5. A new version is 1.8.0, maybe I should update it?
Fixed.
This is my mistake, in AppDelegate I set rootViewController before Setup Parse and check currentUser in viewWillAppear. I make this issue, maybe in iOS > 8.0 the viewWillAppear will be called slower on iOS 7.1.
Every simulator you can use with XCode is its own "sand box" per se. This means that if I'm logged in as a user in Parse with the iPhone 6+ simulator using iOS 8.4, and then I shut down the simulator and run my app on the iPhone 6+ simulator using iOS 8.3 then the app shows that I'm no longer logged in. Try it for yourself. This is normal behavior. If this is not what you are experiencing, then please elaborate your issue and explain in detail what actions you have taken in order to resolve this issue. Your issue could very well be caused by something entirely different that what I think it may be.

Symbol not found: ABAddressBookCreateWithOptions

I've been working on an iPhone app which can brings the contacts from iPhone device to app , i've read about Addressbook privacy control , that is ios6 need ABAddressBookCreateWithOptions , and which is working good in iOS6 but if i'm running this app in iOS5 and below i'm getting error like this :
objective c Symbol not found: ABAddressBookCreateWithOptions , please provide me the solution to run this app in iOS6 and below versions ... thanks ...
A cleaner approach is to actually check for the symbol at runtime:
-(BOOL)isABAddressBookCreateWithOptionsAvailable {
return &ABAddressBookCreateWithOptions != NULL;
}
Take a look at this answer for a full iOS 5/6 compatible approach to reading contacts from the address book.
You can't use it in iOS5 because the docs say Available in iOS 6.0 and later. In iOS 5 use the ABAddressBookCreate version (which is deprecated in iOS 6).

Resources