Delphi 10 Seattle in iOS9 (External Exception 434C4E47432B2B00) - delphi

I created a simple application that accesses a DataSnap server.
When I run in simulator (iOS 9) or iPad 2 (iOS 9.0.1), everything works perfectly.
When I run on the iPhone 5, an error message appears when connecting to DataSnap Server (External Exception 434C4E47432B2B00).
Any idea?

Sergey Krasilnikov added a comment
Hi all!
Good news, this issue has been resolved for Seattle Update 1.
From external Jira: This is a problem with TStringHelper.InternalCompare Next code fails with iOS9 SDK: string.Compare('short', 'loooong', True);

You must change your datasnap server(tcp/ip) to rest server(http)
And change your client plist file (Project.plist)
Go to the bottom of the file and insert the following text above the last /dict tag:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
http://blogs.embarcadero.com/davidi/2015/09/24/43917

Related

Flutter: webview_flutter just displays blank (white) on iOS

The bounty expires in 4 days. Answers to this question are eligible for a +50 reputation bounty.
Cedric wants to draw more attention to this question.
I got it to work on Android, the WebViewWidget displays correctly with the html content, no problem.
For iOS it just displays blank/white. I tried what I have seen suggested by people all over the internet, which is to add a few lines to Info.plist, that allow the WKWebView in iOS to load and display http (not secure, not only https):
<key>io.flutter.embedded_views_preview</key>
<string>YES</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
(^^I don't really know what these lines individually do)
(^^I have also tried lowercase "yes" and <true/> as values for the first one)
I ran flutter clean, then flutter pub get, deleted Podfile.lock, ran pod install (in the ios folder) a bunch of times, but I still can't get the content to show in the webview on iOS (it works on Android), only blank white space where the html content is supposed to appear.
It's important to mention that I get my html from neither http nor https, but I load a String (which is html) and set it like this:
String text = ...
await _controller.loadHtmlString(text);
Is there maybe a way of tricking iOS to think that the html comes from https?
These are some common messages I see printed out in the console (not red, just regular color), and I only get these messages when running the app from android studio, not XCode (on a real iOS device):
[assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
[ProcessSuspension] 0x12d07df20 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=47861, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}
and:
Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
UPDATE: I found out, it also shows a blank/white page on iOS even when I use https, like _controller.loadRequest(Uri.parse('https://flutter.dev'));.
I solved the problem, it was unexpected and not related to http/https stuff... See the comments in below code for explanation
_controller.setNavigationDelegate(
//...
onNavigationRequest: (NavigationRequest request) {
print('onNavigationRequest');
//I first had this line to prevent redirection to anywhere on the internet via hrefs
//but this prevented ANYTHING from being displayed
// return NavigationDecision.prevent;
return NavigationDecision.navigate; //changed it to this, and it works now
},
);
I also removed all those lines from Info.plist, and it still works.

Unable to import files with custom UTI extension on IOS 13

Since the update to IOS 13 importing custom UTI files is not working (works perfectly on devices with 12.4)
I've downloaded the simple working project form this page: https://www.raywenderlich.com/813044-uiactivityviewcontroller-tutorial-sharing-data , which i also used as a base for the sharing system of my app.
On IOS 13 (12.4 works), when get the sample file (from email o data folder) and click on Copy To App, IOS goes back to the main screen, and after a few seconds i get a Safari crash error.
This is the project info.plist section for exporting files:
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Book Tracker Document</string>
<key>UTTypeIconFiles</key>
<array>
<string>book_320.png</string>
<string>book_64.png</string>
<string>book_44.png</string>
<string>book_22.png</string>
</array>
<key>UTTypeIdentifier</key>
<string>com.raywenderlich.BookTracker.btkr</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>btkr</string>
<key>public.mime-type</key>
<string>application/booktracker</string>
</dict>
</dict>
</array>
</key>
Things i tried:
Add an UTImportedTypeDeclarations, with the same details as UTExportedTypeDeclarations ones as there is none in the project ---- STILL CRASH
In this post about at the end, was suggested to remove the section from the info.plist (Not modifying the Document Types section) and create it anew from the interface ---- STILL CRASH (it also causes an infinite loop in xcode when adding array items for public.filneame-extension or mime-type)
Various combinations of the solutions above
This is the main error i always get:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
terminating with uncaught exception of type NSException
Full log is here: log
I'm kind of out out ideas! Please help!
I don't have the answer to your question but I have a similar problem with this same sample app from Ray Wenderlich. Unfortunately the comment section for this tutorial is closed.
I am using the "finished" version which has all the UTI information already set.
In my case I want to save the ".btkr" document to the Files application. That works OK but then if I tap on the .btkr document saved in Files, it opens the BookTracker application but quietly fails in the Book.swift importData(from url: URL) method.
I unraveled the guard statement into do/try/catch blocks and what I see is "The file “New Book.btkr” couldn’t be opened because you don’t have permission to view it." This is being thrown from the "let data = try Data(contentsOf: url)" statement.
The odd thing is if I share the same document via eMail, a tap on the .btkr attachment successfully opens the app and imports the .btkr just fine. Share via AirDrop works as well.
I do not know if this is only an iOS 13 bug because I no longer have any devices with older iOS's. Since the tutorials from Wenderlich are generally very good (this one is from February 2019, before iOS 13) I suspect your problem and my problem are iOS 13 bugs.
I'm seeing exactly the same thing here on my app. Wrapping readFromURL and writeToURL in between startAccessingSecurityScopedResource & stopAccessingSecurityScopedResource helped on my iPad running iOS 13.2.3, but I'm still seeing the Safari crash and unable to open the documents on the iPhone running 13.2.2.

What is PBItemCollectionServicer?

I searched SO ,find nothing about PBItemCollectionServicer.
My question become form my app crash(because of memory rise violently), then print:
PBItemCollectionServicer connection disconnected.
The screen shot:
I have no idea about the PBItemCollectionServicer, whats mean of that?
and how does it work?
why it print here?
Is it relate to my app crash?
Edit -1
As Nir's comment, he suspect if I use the under link framework.
https://github.com/JaviSoto/iOS10-Runtime-Headers/tree/master/PrivateFrameworks/Pasteboard.framework
No , I didn't, I searched my project with no result:
Well, I guess those annoying PBItemCollectionServicer logs appear seconds after you copied (Command+ C) something into your iOS devices or iOS simulator which is running apps via Xcode.
The "universal clipboard" service (seems to) collects strings or images to share between your own iCloud devices (Mac, iOS devices ...)
It works in Sierra & iOS 10 environment
Check this article
This log happens only when under simulator/iOS device while running on Xcode, I think.
I don't know why Xcode team let this somewhat should-be-hidden log displayed... for developers? But couldn't find any documentation... blah blah
"PBItemCollectionServicer connection disconnected." also logs when using iOS 11 table view drag-and-drop and completing a drop. It's benign there, from all I've observed.
I was receiving:
Console Log: "PBItemCollectionServicer connection disconnected."
all of a sudden while debugging an iPhone app while connected via the USB cable to my MacBook.
After a bit of searching it turned out that it was hanging for some time because of this line of code where I was clearing the pasteboard:
[pasteBoard setValue:#"" forPasteboardType:UIPasteboardNameGeneral];
After a lot of google searching without any luck I noticed that it only happens when the iPhone was connected to my Mac.
It turned out to be the shared clipboard causing the hang/delay and log message.
If you turn off "Handoff" on the iPhone (Settings/General/Handoff) and Mac (System Preferences/General/Allow Handoff) then the problem was resolved.
The problem also goes away when you disconnect the USB cable from the Mac so it doesn't affect regular use.
For me, the error occurred when PHAssetCollection fetchAssetCollectionsWithType : called with a block predicate:
PHFetchOptions *fetchOptions = PHFetchOptions.new;
// correct
fetchOptions.predicate = [NSPredicate predicateWithFormat:#"localizedTitle = %#", targetAlbumName];
// wrong
// crash with the error message "PBItemCollectionServicer connection disconnected."
//fetchOptions.predicate = [NSPredicate predicateWithBlock:xxx];
PHAssetCollection * assetCollection = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumRegular options:fetchOptions].firstObject;
I found that when working with drag and drop this error gets cleared up when adding
view.addInteraction(UIDropInteraction(delegate: self))
to the viewDidLoad of the view you are dropping into.
Firstly, this is not an answer to the question. And I failed to find one. It's just some information I think may be helpful for someone who can dig into this and find an answer.
I was tinkering with the copy(_:), cut(_:) and paste(_:) functions of UITextField. Almost every time I did copy/cut/paste in in field, the Xcode gave this message:
2020-07-17 15:45:38.796510+0800 MyApp[3062:1763915] [general] Connection to daemon was invalidated
2020-07-17 15:45:54.179188+0800 MyApp[3062:1763859] PBItemCollectionServicer connection disconnected.
2020-07-17 15:46:53.097783+0800 MyApp[3062:1763859] PBItemCollectionServicer connection disconnected.
2020-07-17 15:46:57.180499+0800 MyApp[3062:1763859] PBItemCollectionServicer connection disconnected.
2020-07-17 15:48:34.901502+0800 MyApp[3062:1764656] PBItemCollectionServicer connection disconnected.
The only relevant code is an extension to UITextField:
extension UITextField {
open override func copy(_ sender: Any?) {
print(sender)
print(text)
}
open override func paste(_ sender: Any?) {
print(sender)
print(text)
}
open override func cut(_ sender: Any?) {
print(sender)
print(text)
}
}
And none of them was called. How weird. Then I commented out this extension, and to my surprise, Xcode still gave the exactly same message. Anyway, after I searched here and there, I found this in Apple Developer Forums, which is discussion about the failure of UIDropInteraction with the same error message. As all the other answers mostly talked about UIPasteboard, I think it is necessary to put it here although it doesn't contain a solution or answer.
I tried running on both Simulator(13.5) and device(13.4.1), with Xcode 11.5, and got the same error message.
I was also receiving a PBItemCollectionServicer connection disconnected line in the console log, when testing an UICollectionViewDragDelegate implementation.
It turned out that my Info.plist file didn't have that required NSUserActivityTypes configuration with the activity identifier of the NSUserActivity used in the NSItemProvider as part of the dragged UIDragItem. After fixing this, the drag-and-drop action finally worked, and the console did log the mysterious line anymore.
In order to make sure drag-and-drop works for you,
you need to specify your type identifier (e.g. com.xxx.TodoList.todoItem) in Info.plist like this:
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.text</string>
</array>
<key>UTTypeDescription</key>
<string>com.xxx.TodoList.todoItem</string>
<key>UTTypeIconFiles</key>
<array/>
<key>UTTypeIdentifier</key>
<string>com.xxx.TodoList.todoItem</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array/>
</dict>
</dict>
</array>

Different behaviour NSAllowsArbitraryLoadsInWebContent IOS 10.1 and 10.2

When loading a certain url in UIWebView in IOS 10.1 it is failing on
Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made"
However the same webview loads fine in iOS 10.2
I can load the url in both 10.1 and 10.2 if I use NSAllowsArbitraryLoads = YES but only in 10.2 with NSAllowsArbitraryLoadsInWebContent = YES
I tested the URL with nscurl --ats-diagnostics and it passes all tests
I think that the issue may have something to do with an ip location validation within the webpage.
Are the differences between 10.1 and 10.2 in the handling of App Transport Security Settings? Are these documented?
---- Edit -----
I managed to resolve my issue by looking at the error in didFailLoadWithError. This told me exactly what the url was that was causing the failure. I added this url to my Exception Domains with NSExceptionRequiresForwardSecrecy=NO (determined using the ats diagnostics)
This fixed my problem but I still would like to understand the differences in the two versions 10.1 & 10.2.
Yes, earlier versions of iOS 10 did still enforce the forward secrecy requirement of app transport security in web views even with the NSAllowsArbitraryLoadsInWebContent key. That was a bug, that was fixed by Apple. The problem is that earlier versions of iOS shipped with the bug so you must be able to handle it, which isn't always possible if you don't know all the possible URLs that your Web you could navigate to. This may be part of the reason that Apple has extended their deadline for enabling app transport security and all apps submitted to the App Store.

NSURLSession/NSURLConnection HTTP load failed and other AdMob warnings for iOS 9

I have an existing app in the App Store that supports both iOS 7 and 8 (though I'll be dropping iOS 7 support shortly).
My latest version of the app has brought both IADs and AdMobs (where AdMobs act as a failover from IADS). With the upcoming launch of iOS 9, and the recent craze of Google requiring the removal of SSL (http://googleadsdeveloper.blogspot.ch/2015/08/handling-app-transport-security-in-ios-9.html
HTTPS request in iOS 9 : NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)), from a beginner's point of view, I'd like to ask about some warnings I'm getting with my app running in Xcode 7 beta 5.
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
There's this link that I came across as well http://timekl.com/blog/2015/08/21/shipping-an-app-with-app-transport-security/?utm_campaign=iOS%2BDev%2BWeekly&utm_medium=email&utm_source=iOS_Dev_Weekly_Issue_213
So, what exactly do I need to do to remove this warning from the console when running my app on iOS 9?
I've come across one list that talks about disabling botched in Xcode, but firstly I don't understand what disabling that does, but also, is that required for this? What does ENABLE_BITCODE do in xcode 7?
Any thoughts on this would be really appreciated.
Read this App Transport Security Technote
Chances are, you'll have to set the NSAllowsArbitraryLoads to YES globally for now, because you aren't in control over what servers your ads come from.
Add below syntax to your app's info.plist,It's work for me.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
because your are calling a server which has self-signed certificate. you have to by pass it.

Resources