Description
Using Ti.Media APIs without using openPhotoGallery will cause a compile error
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1837:17: error: expected a type
[TRACE] - (void)picker:(PHPickerViewController *)picker didFinishPicking:(NSArray<PHPickerResult *> *)results
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1837:75: error: unknown type name 'PHPickerResult'
[TRACE] - (void)picker:(PHPickerViewController *)picker didFinishPicking:(NSArray<PHPickerResult *> *)results
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1792:7: error: use of undeclared identifier '_phPicker'
[TRACE] if (_phPicker != nil) {
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1799:3: error: unknown type name 'PHPickerConfiguration'; did you mean 'UIPasteConfiguration'?
[TRACE] PHPickerConfiguration *configuration = [[PHPickerConfiguration alloc] init];
[TRACE] ^~~~~~~~~~~~~~~~~~~~~
[TRACE] UIPasteConfiguration
[TRACE] In module 'UIKit' imported from /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:33:
[TRACE] /Applications/Xcodebeta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIPasteConfiguration.h:16:12: note: 'UIPasteConfiguration' declared here
[TRACE] @interface UIPasteConfiguration : NSObject <NSSecureCoding, NSCopying>
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1799:44: error: unknown receiver 'PHPickerConfiguration'; did you mean 'UIPasteConfiguration'?
[TRACE] PHPickerConfiguration *configuration = [[PHPickerConfiguration alloc] init];
[TRACE] ^~~~~~~~~~~~~~~~~~~~~
[TRACE] UIPasteConfiguration
[TRACE] In module 'UIKit' imported from /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:33:
[TRACE] /Applications/Xcodebeta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIPasteConfiguration.h:16:12: note: 'UIPasteConfiguration' declared here
[TRACE] @interface UIPasteConfiguration : NSObject <NSSecureCoding, NSCopying>
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1806:19: error: property 'selectionLimit' not found on object of type 'UIPasteConfiguration *'
[TRACE] configuration.selectionLimit = [TiUtils intValue:[args objectForKey:@"selectionLimit"] def:allowMultiple ? 0 : 1];
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1812:33: error: use of undeclared identifier 'PHPickerFilter'
[TRACE] [filterList addObject:PHPickerFilter.imagesFilter];
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1814:33: error: use of undeclared identifier 'PHPickerFilter'
[TRACE] [filterList addObject:PHPickerFilter.livePhotosFilter];
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1816:33: error: use of undeclared identifier 'PHPickerFilter'
[TRACE] [filterList addObject:PHPickerFilter.videosFilter];
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1823:27: error: use of undeclared identifier 'PHPickerFilter'
[TRACE] [filterList addObject:PHPickerFilter.imagesFilter];
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1826:3: error: use of undeclared identifier 'PHPickerFilter'
[TRACE] PHPickerFilter *filter = [PHPickerFilter anyFilterMatchingSubfilters:filterList];
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1826:19: error: use of undeclared identifier 'filter'
[TRACE] PHPickerFilter *filter = [PHPickerFilter anyFilterMatchingSubfilters:filterList];
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1826:29: error: use of undeclared identifier 'PHPickerFilter'
[TRACE] PHPickerFilter *filter = [PHPickerFilter anyFilterMatchingSubfilters:filterList];
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1827:17: error: property 'filter' not found on object of type 'UIPasteConfiguration *'
[TRACE] configuration.filter = filter;
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1827:26: error: use of undeclared identifier 'filter'
[TRACE] configuration.filter = filter;
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1829:3: error: use of undeclared identifier '_phPicker'
[TRACE] _phPicker = [[PHPickerViewController alloc] initWithConfiguration:configuration];
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1829:17: error: use of undeclared identifier 'PHPickerViewController'
[TRACE] _phPicker = [[PHPickerViewController alloc] initWithConfiguration:configuration];
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1831:4: error: use of undeclared identifier '_phPicker'
[TRACE] [_phPicker setDelegate:self];
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1832:9: warning: instance method '-displayModalPicker:settings:' not found (return type defaults to 'id') [-Wobjc-method-access]
[TRACE] [self displayModalPicker:_phPicker settings:args];
[TRACE] ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[TRACE] In file included from /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:11:
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.h:25:12: note: receiver is instance of class declared here
[TRACE] @interface MediaModule : TiModule <
[TRACE] ^
[TRACE] /Users/awam/Documents/Appcelerator_Studio_Workspace/ticreateapp/build/iphone/Classes/MediaModule.m:1832:28: error: use of undeclared identifier '_phPicker'
[TRACE] [self displayModalPicker:_phPicker settings:args];
[TRACE] ^
[TRACE] fatal error: too many errors emitted, stopping now [-ferror-limit=]
var window = Ti.UI.createWindow();
Ti.Media.beep();
window.open()
Steps to reproduce
1. Add the above code to an existing app.js
2. Build for an iOS device
appc run -p ios -T device --build-only
Actual
Compile error
Expected
No compile error
PR: https://github.com/appcelerator/titanium_mobile/pull/12129
Also verify that the test case in TIMOB-27984 still functions as expected
simple guard, confirmed the fix locally by reproducing and confirming the updated code fixes the issue.
*Closing ticket*. Fix verified in SDK version
9.2.1.v20201001120538
, and9.3.0.v20201001144501
. Tested using the test case mentioned in the description. *Test and other information can be found at:* https://github.com/appcelerator/titanium_mobile/pull/12129