1) Storing images locally to be displayed later via the html, most all of the docs say to store them like in ~/images/image1.png. Typescript/Nativescript says to store these by doing this:
fileSystemModule.knownFolders.currentApp(), then join the "/images/image1.png and write the file. This works great on IOS and Android in debug mode and the simulators, but it doesn't work in a Release version of IOS. IOS gives an error saying you can't access this folder. The nativescript documentation clearly says for currentApp that " iOS - this folder is read-only and contains the app and all its resources.".
Thus, if it's IOS, I do what the doc for the Filesystem/IOS module says:
var dirPath;
if (isIOS) {
dirPath = fileSystemModule.knownFolders.ios.library();
dirPath = fileSystemModule.path.join(fileSystemModule.knownFolders.ios.library().path, '/Application Support/myapp/images/image1.png');
I'm able to write and read files from here from TS code fine. However,
2) For displaying these in my page, for an image in my html, I have src='~./Library/Application Support/myapp/images/image1.png' and it's not able to find them. Any suggestions appreciated.
There are a lot of docs saying how to write files locally using currentApp(), but none talk about how this doesn't work in the Release version of IOS.
Related
I am using Xcode 14.2 on macOS Ventura 13.2, working on an iOS app initially created from Xcode's template via New Project > iOS > Document App. I am using Objective-C, not Swift. I am testing in the simulator's "iPad Pro (12.9 in) 6th Generation - iOS 16.2" module.
The template created a UIDocumentBrowserViewController subclass and a UIDocument subclass, which I've been filling in.
I have two problems.
First, the document browser is ignoring its own shouldShowFileExtensions property. I have it set to NO, and I have checked that it is still NO later during runtime; but the browser view still displays filename extensions.
Second, I'd really rather the browser displays the UIDocument.localizedName string instead of the filename. This is a read-only property of UIDocument which is supposedly overridable by the subclass to return whatever string you'd like. My UIDocument subclass's override is never being called.
The override looks like this:
- (NSString*)localizedName
{
return [self projectName];
}
I am not doing anything weird with my subclasses; I've done my best to follow Apple's guidelines and documentation meticulously. My app will create documents that later appear in the browser, and which can be opened again and displayed, so the basics are working; but I have no control over the display name of the documents in the browser.
What am I doing wrong? Thanks in advance for any help.
localizedName is not used by the document browser, or it would have to create a UIDocument for every file in the directories the user visits! This would have a huge performance impact. LocalizedName is only used, as explained in the documentation, to display the document’s name after it is open in error messages and the like.
I have followed this docs in implementing in taking a photo and picking a photo in Xamarin. I was able to implement and worked in picking a photo but I have error in using the function TakePhotoAsync() which is used to open the camera to take picture. I have googling for possible solutions but nothing works for me. I did not modify any permission or add from the current which work on Picking a photo.
It crashes in this line:
var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
{
PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium
});
I am testing in the emulator: AVD_for_Galaxy_Nexus(Android 6.0 - API 23)
Exception:
System.ArgumentException: Unable to get file location. This most likely means that the file provider information is not set in your Android Manifest file. Please check documentation on how to set this up in your project.
By the way, I did solve the error by downgrading the version of the plugin to Xam.Plugin.Media 3.1.2 from Xam.Plugin.Media 3.1.3. I didn't change anything in my codes.
I have configured multiple firebase databases in my single iOS app.
here is the code in my AppDelegate, that selects which firebase db I have to choose at run-time
func initFirebase(){
// Check the Flag which Firebase to connect with
if (UserDefaultsManager().getFirebaseConfiguration()){
let resource = UserDefaultsManager.env_firebase?.value(forKey: "resource") as! String
print("resource \(resource)")
let filePath = Bundle.main.path(forResource: resource, ofType:"plist")
let options = FirebaseOptions(contentsOfFile:filePath!)
FirebaseApp.configure(options: options!)
}
}
This is all working fine.
Issue is with crash reporting, I have to make the firebase crash reporting dynamic too.
Right now I have configured my firebase crash reporting with jBackend-genetech-dev-crash-reporting.json , here is my crash reporting shell script.
# Replace this with the GOOGLE_APP_ID from your GoogleService-Info.plist (its my genetech-dev firebase service account actually) file
GOOGLE_APP_ID=1:740631780656:ios:ddccc74c2f726b3a
# Replace the /Path/To/ServiceAccount.json with the path to the key you just downloaded
"${PODS_ROOT}"/FirebaseCrash/upload-sym "${SRCROOT}/JamesApp/jBackend-genetech-dev-crash-reporting.json"
So When I connect my app to the firebase db with configuration defined in service account GoogleService-Info.plist its working flawlessly i.e I am getting the crash reports with the exact line number of the crash. here is the screenshot.
But whenever I connect with other firebase accounts example GoogleService-Info-mh6-prod.plist, I am getting the crash reports in this case too but with no Line number, see screenshot below.
More Info
Am I testing on real device? Yes
Is bitcode support disabled in my project? Yes
Question:
How to make my crash reporting script dynamic in my case.
I have seen this iOS Firebase Crash Reporting - Error running build script , i.e making the script dynamic depending upon the app configuration variable i.e release/debug. but my scenario is different, my app select the firebase database depending on the app's System settings bundle. seen screenshot below.
I have a problem getting the new crash reporting in Parse 1.6 to work. The symptoms are the same as parse.com 1.6 crash analytics not working , but my reputation is too low to add my information.
1) I followed the quick start and guide to set up crash reporting and upload my symbols
https://parse.com/docs/ios_guide#crashreporting/iOS
https://parse.com/apps/quickstart#analytics/crashreporting/ios/existing
2) I'm following the instructions to generate a crash report by running the app directly in the simulator (iOS 7-8) and on the device (iOS 6) without a debugger attached. On the simulator I can actually see the minidump being created in Library/Parse/PFCrashReports.
3) When launching the app again I get the message "Breakpad Uploader: unable to determine minidump file length" and the crash dump disappears from the file system. So I assume Parse uses google breakpad under the hood, and the error is created by Uploader.mm because the call to stat() fails. I tried the same call in my own code and it succeeds there.
My gut feeling is that there is either a permission problems, or some other code locks the file while the uploader tries to access it. As the parse libraries are closed source it is hard to check anything, though. It is a bit suspicious that other people don't seem to have a problem with this, which may mean some other settings or configuration problem.
I use the forge.file.saveURL to save a JSON object to the local file system, then I use forge.file.String to read the contents and display them on the device.
This works just fine on IOS and Android but it seem on Android after the device has closed the app or force closed it after being open for a while when I reopen the app and try and access the file I get the error message in the console
Native call file.string with task.params:
{"uri":"file:///storage/sdcard0/Android/data/com.phonegap.conbop/files/Download/594f9cdc-a791-40ef-a40b-75d16948a9ca"}
[DEBUG] Returned: {"content":{"message":"Error reading
file","type":"UNEXPECTED_FAILURE","subtype":null},"callid":"508FE1AD-EB74-4377-8FDA-AA7318457B5C","status":"error"}
I have tested the IOS and this does not seem to happen there, its almost like the file is getting corrupt or something but what is strange is a also use the file.saveURL to save images etc and those work just fine so I'm not sure why this one is having issues.