Posts

Post not yet marked as solved
0 Replies
396 Views
I am trying to configure a Parse server & iOS app combination with push notifications. The Parse server is a docker container, currently run as a Docker container on a private network behind a reverse proxy, i.e. each container does not have any external inbound traffic allowed unless defined, but is able outbound. I am testing the iOS app also running on my local network initially.I have followed various guides at:Ray Wenderlich and another about ParseAppcodaParse’s own Guides, right down to the section on adding my device to Parse with PFInstallationI have the CSR file, the downloaded `.cer` file from the Apple Developer portal and the exported `p.12` from the installed certificate.From this configuration, I have run the iOS app a couple times on my iOS 13.4 iPhone, so it has asked for push notification permission and completed the registration / installation of the device into Parse. This is listed as an "installation" as Parse refers to it.Using their separate Dashboard UI, I attempt to send a notification to the "everyone" audience, i.e. all registered devices. But it is never received on the device. I downloaded the APNS-Tool app from the Mac App Store and from there, using the same certificates and private keys, I sent notification, that appeared as though from my iOS demo app on the same device, so I know the certificates are in order.Following the Parse guide, a notification can be simulated with, which I have run on the Parse container terminal:curl -X POST \ -H "X-Parse-Application-Id: you_app_id" \ -H "X-Parse-Master-Key: your_master_key" \ -H "Content-Type: application/json" \ -d '{ "where": { "deviceType": { "$in": [ "ios", "android" ] } }, "data": { "title": "The Shining", "alert": "All work and no play makes Jack a dull boy." } }'\ http://your_server_address:1337/parse/pushMy Docker container uses a different port number, but above is the default. For me, this returns:{"result":true}I have also applied the additional data fields, following guidance from Parse documentation: "push-type" / "push_type" / "apns-push-type" = "background""content-available": 1The notification is not received on the device, but is viewable in the Past Pushes section of the Dashboard UI. This would seem to be functioning as expected with message sent up successfully to Apple's APNS servers. I don't know what else to try.Can anyone provide assistance?
Posted Last updated
.
Post not yet marked as solved
0 Replies
1.8k Views
There does not seem to be much authoritative material about how to handle this.I have an image (actually a photo sent from another device). I would like to save this to the local device's Photo Library, which I am told to use the PhotoKit via PHAssetCreationRequest.forAsset() method.When I do this, and open the newly added photo with an EXIF data viewer app, it does not contain the associated metadata.However, the Photo Library suggests it has some metadata. Specifically, if I drill into the containing "Moment" the photos are within, my new photo drops a pin on a map in the same location. And it has the creationDate values as well.This SO thread suggests Photo Library retains it's own separate database of this information. Is this populated by the call to the above method?https://stackoverflow.com/questions/31664822/phasset-location-gps-metadata-whats-wrong/31665119#31665119This thread suggests EXIF data is only embeddable in JPEG images, not PNG.https://forum.xojo.com/54008-exif-location-data-with-camera-images/0Other forums and support threads suggest using other frameworks, like Core Media, Core Graphics, ALAssetsLibrary and Core Image methods to achieve this.https://stackoverflow.com/questions/7965299/write-uiimage-along-with-metadata-exif-gps-tiff-in-iphones-photo-libraryHow should I know about all these various methods that seem to do the same thing?Why and when should I use each?Is there a preferred approach? Or a simpler approach?If I import a JPEG image with embedded EXIF data (i.e. manually add these via the Core Media, or other, frameworks first) to the Photo Library, does it read in the avialable EXIF data and makes use of it within it's own database?Thanks
Posted Last updated
.
Post not yet marked as solved
1 Replies
491 Views
I am fetching moments from the local device, and looping through to append what is found into 2 arrays:1st array contains moment "metadata", all the alphanumeric data types, called var moments = [Moment]()2nd array contains an array of UIImage of all photos per moment, called var images = [[UIImage]]()My current code seems to be producing an extra "moment" in the `images` variable, which I can see manually in the Photos app. I just don't understand why within the same loop, 1 variable includes this "moment" and the other does not.---func gatherLocalMoments(fromDate: Date?) { // ADD AN OPTIONS PARAMETER = all, last 2 weeks, user selection, etc let photoOptions = PHFetchOptions() photoOptions.sortDescriptors = [NSSortDescriptor(key: "startDate", ascending: false)] let fetchOptions = PHFetchOptions() fetchOptions.sortDescriptors = [NSSortDescriptor(key: "startDate", ascending: true)] if let date = fromDate { // Valid date set let predicate = NSPredicate(format: "startDate > %@", date as NSDate) photoOptions.predicate = predicate } let imageHandler = PHImageManager.default() if let allMoments : PHFetchResult = PHAssetCollection.fetchAssetCollections(with: PHAssetCollectionType.moment, subtype: PHAssetCollectionSubtype.any, options: photoOptions) { if allMoments.count > 0 { for i in 0..<allMoments.count { // GET MOMENT METADATA if let moment : PHAssetCollection = allMoments.object(at: i) { if let lon = moment.approximateLocation?.coordinate.longitude { if let lat = moment.approximateLocation?.coordinate.latitude { let thisMoment = Moment(localizedNames: moment.localizedLocationNames, startDate: moment.startDate, longitude: lon, latitude: lat, estimatedCount: moment.estimatedAssetCount) moments.append(thisMoment) } } // GET MOMENT IMAGES if let fetchResult : PHFetchResult = PHAsset.fetchAssets(in: moment, options: nil) { if fetchResult.count > 0 { var momentImages = [UIImage]() for j in 0..<fetchResult.count { imageHandler.requestImage(for: fetchResult.object(at: j), targetSize: CGSize(width: 100, height: 100), contentMode: PHImageContentMode.aspectFill, options: nil, resultHandler: { image, info in if let image = image { print("i: \(i), j: \(j)") momentImages.append(image) } }) } images.append(momentImages) } } } } } } }---Running this, I had 6 "moments". The contents of var moments:Moment 0 = 10 imagesMoment 1 = 49 imagesMoment 2 = 3 imagesMoment 3 = 17 imagesMoment 4 = 3 imagesMoment 5 = 20 imagesHowever, it is actually creating an extra "moment" in the images array. This is the contents of var images:Moment 0 = 10 imagesMoment 1 = 49 imagesMoment 2 = 3 imagesMoment 3 = 3 images // < -- This is the extra momentMoment 4 = 17 imagesMoment 5 = 3 imagesMoment 6 = 20 imagesIf i go into my Photos, I can see these extra images. The "header/sub-header" are listed differently than other photos. I am not sure if it's technically a "moment" or something else.The event on 17th July. It has no 2nd/sub-title row. It just looks slightly different. I believe these are photos taken within another app I use for collecting receipts. I didn't even realise it was saving these images to my library in this way.In any case, my expected behaviour of the 2 loops above:ONLY if it's a recognised "moment" will it enter the loop and populate moments array; andONLY within a recognised "moment" THEN will it grab the associated images in the imagesarray"Non-moments" should be ignored altogether by both arraysUltimately, the current app architecture means I need the elements of both arrays to match up (whichever is the correct answer!)Can I ask for assistance with this please?
Posted Last updated
.
Post not yet marked as solved
0 Replies
299 Views
I have seen examples of code where a string value, and other similarly simple data types are sent via MultipeerConnectivity. There are also examples of how the Codable protocol can be used with en/decoding of JSON data payloads.How can I convert a PHAssetCollection from 1 Apple device to another, running the same app, which will have sender/receiver functions defined using MultipeerConnectivity? There is no default <object>.data() option. The same principle would apply for any other object that my app creates an instance of.
Posted Last updated
.
Post not yet marked as solved
0 Replies
309 Views
I have seen apps that have an on-screen prompt on 1 device, like 4 or 6 digits, that is entered on the second. Is this a built-in API, or is it entirely custom written? Specifically used to connect another device, running either the same app or some helper / remote control app.In my use case, I intend to run an app on multiple devices that can connect to each other and share the app's data. One direction of access will be from an AppleTV to an iOS device (phone or pad). I would like the user's phone to enter in this code.Can anyone provide pointers, examples or other material so i can learn more, please?Thanks
Posted Last updated
.
Post not yet marked as solved
1 Replies
445 Views
Can I connect to another device (iOS, tvOS, macOS) using multipeer or other connectivity and instantiate objects of the remote device's frameworks, like to access the camera or photos or other media / av libraries? Don't mind any initial action screens / prompts to authorize, just trying to minimise needing an app install in this discovery exercise.Or would an app be required running on each device (or some client / server setup) and a connection using typical frameworks, like Network.framework, multipeer conn, wifi, whatever? This follows the very often linked ralfebert tutorial / article (in my research so far).Thanks
Posted Last updated
.
Post not yet marked as solved
1 Replies
431 Views
What options are available to connect to a discovered device's Photo Library with PhotoKit? Not via iCloud, but any device found on the network.I didn't find any reference under the PhotoKit developer section, though if anyone knows, I would appreciate helpers / tips.Or would this be via Bonjour / network.framework method(s)? I presume this may need more of a client/server architecture, than an ad-hoc data exchange method? Therefore, a custom app (i.e. my app) running on both devices?I was hoping not to need a running app on both devices, but so that I could dynamically connect from an active device and instantiate a PHAssetCollection from the other device.Thanks
Posted Last updated
.