WKWebView problems in iOS 9 - swift2

I'm having trouble with WKWebView in XCode 7 using the iOS 9 sdk. For some reason, half of the websites I try to load come up blank (for example mobile Facebook).
WKWebView worked perfectly when I built my app on iOS 8. I haven't changed any of the code for loading webpages (I used loadrequest with a nsurl), and I know that the webviews are active because some links do load.
Is this a possible bug?

This might be related to a new feature called ATS (App Transport Security), which was introduced in iOS 9.
Please see:
https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/
All connections using the NSURLConnection, CFURL, or NSURLSession APIs
use App Transport Security default behavior in apps built for iOS 9.0
or later, and OS X 10.11 or later. Connections that do not follow the
requirements will fail.
It is possible to add exceptions or to allow any non-secured connections. For example, you can add this to your Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

Related

macOS Granting full-disk access to sandboxed app not working

I'm experimenting with full-disk access and can't make it working. Here is list of steps I did:
Sandbox is turned ON. In fact the entitlements file looks like:
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.bookmarks.app-scope</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
I created archive of the app and tried to distribute it using boths Developer ID or Development methods
I placed the binary of my app to /Applications folder
I went to System Preferences -> Security & Privacy -> Privacy -> Full Disk Access and added access to my app in /Applications folder
Of course I'm NOT attached to the app with Xcode
I'm testing it in Xcode 11 and on Catalina. It's dummy app, opening NSOpenPanel to let user select archives to decompress and tries to decompress it in the same directory.
In fact it's not about NSOpenPanel, the question is:
What is necessary to do to make sandboxed app using full-disk access?
Any hints? Am I doing anything wrong?
Here is solution found for iTerm2 (it is worth read how solution was found). It just adds this to application plist:
<key>NSSystemAdministrationUsageDescription</key>
<string>I want to read all your files</string>
Documentation is a bit fuzzy.
Sadly this solution doesn't work for launchctld daemons (this is what I need). I think daemons are an exception since the do not see UI at all.
But for regular applications it should work like a charm (didn't test it yet).

How to find whether particular app is installed on device and version number of that app in Xamarin forms

I want to find whether a particular app is installed on device and retrieve the version number of that app. How can i do this in Xamarin forms? I need to implement this in both Android and iOS.
iOS:
Version:
Retrieving the version number of other app in iOS is impossible.
Is installed:
But, if you know the URL Scheme of a third party app, you can use canOpenURL(_:) to check if that app is installed on the device. If it returns true, it means the app is installed.
For example, you can check if Microsoft Outlook app is installed on the iOS device via the link ms-outlook:// by using the following code snippet:
if(UIApplication.SharedApplication.CanOpenUrl(new NSUrl(new NSString("ms-outlook://"))))
{
//YOUR CODE...
}
Notice that, if it is in iOS 9 or above, you have to add the LSApplicationQueriesSchemes in the info.plist to allow the url scheme, like this:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>ms-outlook</string>
</array>
Android:
In Android, you can use PackageManager and PackageInfo to check if any app is installed and the version of it.
There're some related SO cases you can refer to:
How to check programmatically if an application is installed or not in Android?
How To Get Another App's Version Name
Checking external app version name in android

Facebook log in with Parse SDK (iOS 9, Xcode 7.1, Swift 2.1)

I've been trying to implement Facebook log in. As the titles says, I'm using Xcode 7.1, Swift 2.1, iOS 9.1, Parse SDK (ParseFacebookUtilsV4).
I have read Parse doc and Facebook doc, and already setup the .plis according to iOS 9 requirements.
The thing is, when the app runs and calls logInInBackgroundWithReadPermissions(permissions:, block:), I'm getting:
-canOpenURL: failed for URL: "fbauth2:/" - error: "(null)"
Does anyone knows how to do this?
You might need to add this to the plist as well. Not sure if it was documented on the Facebook docs.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>`enter code here`
</array>
Each item is for a different part of Facebook SDKs so you might only need to add the fbauth2 one. The others are there in case you need them.

NSDocumentController openDocument: panel no longer permits access to app iCloud container in OS X 10.11 El Capitan

I have an OS X/iOS App that uses the old style ubiquitous container id TEAMID.com.companyname.product, and is built using NSDocument on OS X and UIDocument on iOS.
File opening has been working fine on OS X 10.8, 10.9 and 10.10 using the built in NSDocumentController openDocument: panel. In 10.10 this panel was extended by Apple to permit iCloud Drive access. At the top of the panel the selector titled “iCloud Library” shows “Appname - iCloud” and “iCloud Drive” as options.
Selecting the former gives access to documents in the App ubiquity container, and the later shows available iCloud Drive folders.
In 10.11 El Capitan, selecting “Appname - iCloud” - the view doesn’t change (you see the top level view of iCloud Drive Folders). There is no warning message. Selecting the Appname under iCloud in the sidebar has the same result.
Given the nature of the application (the data is private and isn’t designed to be read by any other application) it isn’t ideal to make the ubiquity folder public - so I would prefer not to go down that path.
A work around is to search for the appropriate file type (kind) in the request panel and select Search: This Mac - this works fine, as do saved URLs from previous opens. So App sandboxing isn’t causing the problem.
Obviously I would like the 10.10 behaviour to continue - but it isn't obvious how to achieve this or if it is a bug. It may be that Apple assume all apps built using NSDocument would wish to make their App containers public.
It does appear that this issue is a bug in OS X 10.11, and the standard NSDocument file open/save/move panel fails to be coerced into the old behaviour. However a reasonably simple solution is to provide two new application menu items:
Open iCloud listing all available documents in the (private) ubiquity container,
Move to iCloud using [NSDocument moveDocumentToUbiquityContainer:].
You need to make the apps iCloud container Public by adding the following to your info.plist file.
<key>NSUbiquitousContainers</key>
<dict>
<key>HHWT75NS6T.au.com.ossh.appName</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>None</string>
</dict>
</dict>

how to remove the service, time and charging indications at the top of iOs7 device

I built an app using MGWT and GwtPhonegap which is running good in ios6. I updated my Xcode to make it compatible to ios7. And I also updated my iPhone OS from 6 to ios7. I installed the same app through the updated Xcode into my device. In each screen of my app,the device showing
service indication(left), time (center) and charging indication(right). Is there any possibility
to remove these with the Xcode configuration or is there any other approach to do this?
thanks in advance
In your project's config.xml there is a preference called "fullscreen". Set it to "true".
(assuming you're using Phonegap 3+)
In older versions: add a key called UIStatusBarHidden to your [appname]-info.plist and set it to true. In raw XML that would be
<key>UIStatusBarHidden</key>
<true />

Resources