[TIMOB-26243] Hyperloop: iOS - Cannot use PHPhotoLibrary API due to cast errors
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 8.0.0 |
Fix Version/s | n/a |
Components | Hyperloop |
Labels | engSchedule, ios |
Reporter | Donald Anderson |
Assignee | Jan Vennemann |
Created | 2018-07-27T10:11:36.000+0000 |
Updated | 2019-04-16T15:35:48.000+0000 |
Description
I want to access the photos saved on the device in titanium. If I create a new project and add
var photos = require('PhotoKit/PHPhotoLibrary');
I get the following build log.
[INFO] : Alloy compiled in 0.46666s
[INFO] : Alloy compiler completed successfully
[INFO] : JavaScript files need to be encrypted
[INFO] : Creating Xcode project
[INFO] : Creating Entitlements.plist
[INFO] : Creating Info.plist
[INFO] : Disabling ATS
[INFO] : Creating main.m
[INFO] : Creating Xcode config files
[INFO] : Copying Titanium libraries
[INFO] : Copying Titanium iOS files
[INFO] : Installing default LaunchScreen.storyboard
[INFO] : Creating debugger and profiler plists
[INFO] : Analyzing Resources directory
[INFO] : Analyzing platform files
[INFO] : Analyzing module files
[INFO] : Analyzing localized launch images
[INFO] : Analyzing CommonJS modules
[INFO] : Creating asset catalog
[INFO] : Creating app icon set
[INFO] : Creating launch logo image set
[INFO] : Creating launch image set
[INFO] : Creating assets image set
[INFO] : Processing JavaScript files
[INFO] : Writing app properties
[INFO] : Encrypting JavaScript files
[INFO] : Writing i18n files
[INFO] : Processing Titanium symbols
[INFO] : Removing files
[INFO] : Optimizing .plist and .png files
[INFO] : Starting Hyperloop assembly
[INFO] : Skipping Hyperloop compile, no usage found ...
[INFO] : Finished Hyperloop assembly in 0 seconds
[INFO] : Invoking xcodebuild
[INFO] : Finished building the application in 13s 265ms
[INFO] : Installing app on device: Ideagen PLC iPad
[INFO] : App successfully installed on device: Ideagen PLC iPad
Please manually launch the application
[INFO] : hyperloop-photo-album/1.0 (7.2.0.ecae6740fe)
[ERROR] : Script Error Couldn't find module: PhotoKit/PHPhotoLibrary for architecture: armv7
It appears to skip hyperloop assembly. If I build the app again after adding var view = require('UIKit/UIView');
I get the following log.
[INFO] : Alloy compiled in 0.47754s
[INFO] : Alloy compiler completed successfully
[INFO] : JavaScript files need to be encrypted
[INFO] : Creating Xcode project
[INFO] : Creating Entitlements.plist
[INFO] : Creating Info.plist
[INFO] : Disabling ATS
[INFO] : Creating main.m
[INFO] : Creating Xcode config files
[INFO] : Copying Titanium libraries
[INFO] : Copying Titanium iOS files
[INFO] : Installing default LaunchScreen.storyboard
[INFO] : Creating debugger and profiler plists
[INFO] : Analyzing Resources directory
[INFO] : Analyzing platform files
[INFO] : Analyzing module files
[INFO] : Analyzing localized launch images
[INFO] : Analyzing CommonJS modules
[INFO] : Creating asset catalog
[INFO] : Creating app icon set
[INFO] : Creating launch logo image set
[INFO] : Creating launch image set
[INFO] : Creating assets image set
[INFO] : Processing JavaScript files
[INFO] : Writing app properties
[INFO] : Encrypting JavaScript files
[INFO] : Writing i18n files
[INFO] : Processing Titanium symbols
[INFO] : Removing files
[INFO] : Optimizing .plist and .png files
[INFO] : Starting Hyperloop assembly
[WARN] : [Hyperloop] couldn't find class Protocol * {"name":"protocol","optional":false,"type":{"type":"objc_pointer","value":"Protocol *"}}
[WARN] : [Hyperloop] Not sure how to handle: name= nodeInteraction type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= eventValues type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= options type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= uc_stack type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= name type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= dylib type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= name type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= fl type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= timeout type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= name type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= name type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= fvmlib type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= gr_group type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= gsr_group type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= gsr_source type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= __u6_addr type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= ipi6_addr type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= ipi_spec_dst type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= ipi_addr type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= ip6m_addr type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= imr_multiaddr type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= imr_interface type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= imr_multiaddr type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= imr_sourceaddr type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= imr_interface type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= imr_multiaddr type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= imr_address type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= ip_dst type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= ipv6mr_multiaddr type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= it_interval type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= it_value type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= fsec_acl type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= msfr_group type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= name type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= linked_modules type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= path type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= ru_utime type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= ru_stime type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= _bf type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= _ub type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= _lb type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= __sigaction_u type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= sigev_value type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= si_value type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= sin_addr type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= sin6_addr type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= __darwin_rune_t type= function_proto value= function_proto
[WARN] : [Hyperloop] Not sure how to handle: name= client type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= umbrella type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= sub_library type= unknown type: 119 value= unknown type: 119
[WARN] : [Hyperloop] Not sure how to handle: name= sub_umbrella type= unknown type: 119 value= unknown type: 119
[INFO] : [Hyperloop] Generating class iAd/ADBannerView
...
[INFO] : [Hyperloop] Generating class PDFKit/PDFView
[INFO] : [Hyperloop] Generating class Photos/PHAdjustmentData
[INFO] : [Hyperloop] Generating class Photos/PHAsset
[INFO] : [Hyperloop] Generating class Photos/PHAssetChangeRequest
[INFO] : [Hyperloop] Generating class Photos/PHAssetCollectionChangeRequest
[INFO] : [Hyperloop] Generating class Photos/PHAssetResource
[INFO] : [Hyperloop] Generating class Photos/PHCollection
[INFO] : [Hyperloop] Generating class Photos/PHCollectionListChangeRequest
[INFO] : [Hyperloop] Generating class Photos/PHContentEditingInput
[INFO] : [Hyperloop] Generating class Photos/PHImageManager
[INFO] : [Hyperloop] Generating class Photos/PHImageRequestOptions
[INFO] : [Hyperloop] Generating class Photos/PHLivePhoto
[INFO] : [Hyperloop] Generating class Photos/PHLivePhotoRequestOptions
[INFO] : [Hyperloop] Generating class PhotosUI/PHLivePhotoView
[INFO] : [Hyperloop] Generating class Photos/PHObject
[INFO] : [Hyperloop] Generating class Photos/PHVideoRequestOptions
[INFO] : [Hyperloop] Generating class PassKit/PKAddPassesViewController
...
[INFO] : [Hyperloop] Generating custom Hyperloop/Custom
[INFO] : Generation took 3791 ms
[INFO] : Forcing rebuild: Xcode project has changed since last build
[INFO] : Finished Hyperloop assembly in 20.83 seconds
[INFO] : Invoking xcodebuild
[INFO] : Finished building the application in 37s 603ms
[INFO] : Installing app on device: Ideagen PLC iPad
[INFO] : App successfully installed on device: Ideagen PLC iPad
Please manually launch the application
[INFO] : hyperloop-photo-album/1.0 (7.2.0.ecae6740fe)
[ERROR] : Script Error Couldn't find module: PhotoKit/PHPhotoLibrary for architecture: armv7
This time it has compiled hyperloop but in the list of generated hyperloop classes logged PhotoKit/PHPhotoLibrary doesn't appear, but Photos/PHPhotoLibrary does so if I try again with var photos = require('PhotoKit/PHPhotoLibrary');
I get the following build log.
[INFO] : Alloy compiled in 0.40499s
[INFO] : Alloy compiler completed successfully
[INFO] : JavaScript files need to be encrypted
[INFO] : Creating Xcode project
[INFO] : Creating Entitlements.plist
[INFO] : Creating Info.plist
[INFO] : Disabling ATS
[INFO] : Creating main.m
[INFO] : Creating Xcode config files
[INFO] : Copying Titanium libraries
[INFO] : Copying Titanium iOS files
[INFO] : Installing default LaunchScreen.storyboard
[INFO] : Creating debugger and profiler plists
[INFO] : Analyzing Resources directory
[INFO] : Analyzing platform files
[INFO] : Analyzing module files
[INFO] : Analyzing localized launch images
[INFO] : Analyzing CommonJS modules
[INFO] : Creating asset catalog
[INFO] : Creating app icon set
[INFO] : Creating launch logo image set
[INFO] : Creating launch image set
[INFO] : Creating assets image set
[INFO] : Processing JavaScript files
[INFO] : Writing app properties
[INFO] : Encrypting JavaScript files
[INFO] : Writing i18n files
[INFO] : Processing Titanium symbols
[INFO] : Removing files
[INFO] : Optimizing .plist and .png files
[INFO] : Starting Hyperloop assembly
[INFO] : Forcing rebuild: Xcode project has changed since last build
[INFO] : Finished Hyperloop assembly in 12.12 seconds
[INFO] : Invoking xcodebuild
[ERROR] : ** BUILD FAILED **
[ERROR] : The following build commands failed:
[ERROR] : CompileC build/Intermediates/hyperloop-photo-album.build/Debug-iphoneos/hyperloop-photo-album.build/Objects-normal/armv7/photos.o /Users/donaldanderson/Documents/Appcelerator_Studio_Workspace/hyperloop-photo-album/build/hyperloop/ios/js/photos/photos.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
[ERROR] : (1 failure)
This time I get the compile error I described in AC-5813. The issue was closed as invalid with the advice to use PhotoKit/PHPhotoLibrary instead of Photos/PHPhotoLibrary. Neither seem to work for me and I'm not sure if it's a bug or if I'm doing something wrong. I haven't posted full logs as this description seems to have a 32,767 character limit.
Attachments
File | Date | Size |
---|---|---|
Log 1 PhotoKit.PHPhotoLibrary | 2018-07-27T11:08:43.000+0000 | 9535 |
Log 2 Added UIKit.UIView | 2018-07-27T11:08:43.000+0000 | 129376 |
trace level log.txt | 2018-07-27T14:37:14.000+0000 | 3517485 |
Hey there! Although duplicate tickets are not advised, it's fine for this one. If
Photos/PHPhotoLibrary
throws a build error, you need to attach the full log as an attachment (not inside the description field). *EDIT*: Please add the trace logs instead of the info logs, as they contain more information. Also, please remve sensitive data if any.Sorry about the duplicate. I wasn't sure if a ticket marked as closed would be monitored. I've attached the complete build logs from the description.
I am sorry suggesting "PhotoKit", it seems like Apple lacks some clear documentation on the actual import there. So "Photos/PHPhotoLibrary" should definitely work. If it doesn't, it's either a bug or you are building for a target version that is lower than a property/method that is used by the API. Please add the full trace log of using the following require:
Note: You can do that in the Terminal by running
appc run -p ios -l trace
or select "Trace" for the log-level in Studio (above the console).No need to apologise. I've been finding apple's documentation unclear too. I have attached a trace level log. Thank you for helping with this.
Valid bug! Here is the root cause from the trace:
I cannot commit to a timeframe this can be fixed, we will give it a shot next sprint. [~donald.anderson] Can you also attach the generated "photos.m" from
hyperloop-photo-album/build/hyperloop/ios/js/photos/photos.m
?Thanks. Do you happen to know of any way to get all the photos save on a device in titanium for iOS and Android? All I can find in the documentation is Ti.Media.openPhotoGallery.
Fetch via API or select from the UI?
Fetch via API. We need to go through all photos taken to look for certain images that our app failed to upload. We should be able to identify which images are the missing ones by examining the metadata. I have the photos.m file you requested but I seem to have lost the option to add attachments after this ticket was converted to a TIMOB issue.
Maybe with this one?
Read more [here](https://developer.apple.com/documentation/photokit/phasset/1624725-fetchassetswithmediatype). Otherwise, you could use a native module as a workaround.