Property with 'retain (or strong)' attribute must be of object type
Closed this issue · 5 comments
Describe the bug
Semantic Issue (Xcode): Property with 'retain (or strong)' attribute must be of object type
SDImageCacheConfig.h:136:0
Could not build the application for the simulator.
Platform
- Android
- iOS
- Web
- Desktop
Platform OS version
- os 14.3
- (simulator) ip14p (mobile) ios • com.apple.CoreSimulator.SimRuntime.iOS-16-4
How are you picking?
onPressed: () async {
FilePickerResult? result = await FilePicker.platform.pickFiles(
type: FileType.image,
);
if (result != null) {
print(result.files.first);
}
},
Details to reproduce the issue
when I hot restart flutter, some bug report as follow
Reloaded 307 of 1007 libraries in 1,759ms (compile: 1355 ms, reload: 135 ms, reassemble: 56 ms).
Restarted application in 446ms.
flutter: [MethodChannelFilePicker] Unsupported operation. Method not found. The exception thrown was: MissingPluginException(No implementation found for method image on channel miguelruivo.flutter.plugins.filepicker)
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method image on channel miguelruivo.flutter.plugins.filepicker)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:332:7)
<asynchronous suspension>
#1 MethodChannel.invokeListMethod (package:flutter/src/services/platform_channel.dart:520:35)
<asynchronous suspension>
#2 FilePickerIO._getPath (package:file_picker/src/file_picker_io.dart:99:33)
<asynchronous suspension>
#3 new _PostCreateFormState.<anonymous closure> (package:flutter_application_1/main.dart:67:36)
<asynchronous suspension>
then flutter clean
, pod deintegrate
,pod cache clean --all
, rm podfile
and flutter pub get
, pod install
, and build iOS app, I got these
Launching lib/main.dart on ip14p in debug mode...
Xcode build done. 3.2s
Failed to build iOS app
Semantic Issue (Xcode): Property with 'retain (or strong)' attribute must be of object type
/test/flutter_application_1/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.h:136:0
SDImageCacheConfig.h:136
Could not build the application for the simulator.
Error launching application on ip14p.
Exited (1).
Error Log
mentioned above
Flutter Version details
$ flutter doctor -v
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.3 23D56 darwin-arm64, locale zh-Hans-CN)
• Flutter version 3.19.6 on channel stable at /Users/user/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 54e66469a9 (6 days ago), 2024-04-17 13:08:03 -0700
• Engine revision c4cd48e186
• Dart version 3.3.4
• DevTools version 2.31.1
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/user/Library/Android/sdk/
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /Users/user/Library/Android/sdk/
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15E204a
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
[✓] VS Code (version 1.88.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.86.0
[✓] Connected device (3 available)
• ip14p (mobile) • • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.3 23D56 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.123
[✓] Network resources
• All expected network resources are available.
• No issues found!
main.dart as these
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: SingleChildScrollView(
child: Container(
padding: EdgeInsets.all(16),
child: SafeArea(
child: PostCreateForm(),
),
),
),// This trailing comma makes auto-formatting nicer for build methods.
);
}
}
class PostCreateForm extends StatefulWidget {
@override
State<PostCreateForm> createState() => _PostCreateFormState();
}
class _PostCreateFormState extends State<PostCreateForm> {
final formKey = GlobalKey<FormState>();
final meidabutton = Container(
child: TextButton(
child: Text('upload file'),
style: TextButton.styleFrom(
textStyle: TextStyle(fontSize: 20),
minimumSize: Size(double.infinity, 60),
),
onPressed: () async {
FilePickerResult? result = await FilePicker.platform.pickFiles(
type: FileType.image,
);
if (result != null) {
print(result.files.first);
}
},
),
);
@override
Widget build(BuildContext context) {
return Form(
key: formKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
meidabutton,
],
),
);
}
}
SDWebImage
is one of file_picker
's transitive dependencies, through DKImagePickerController.
Thank you very much for your reply, before I suspected that my Apple laptop system version might be too high, and I installed anoconda, which may have polluted the environment variables, so I reinstalled the system, reconfigured the environment variables, and just now I tried to run my script, and found that it finally works perfectly. Thank you again
This issue is stale because it has been open for 7 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.