小编elm*_*mir的帖子

如何获取仅具有位置数据的PHAssets

在iOS的Photos框架中,为了PHAssets使用特定过滤器来请求一组,您可以使用fetchAssetsWithOptions:options并传递一个PHFetchOptions带有所需过滤器的对象.

我试图过滤掉任何PHAssets没有位置资产元数据对象的东西,并且不完全确定是否可以使用该predicate选项完成PHFetchOptions.根据是否存在位置,可能有另一种方法来过滤掉资产,但我并不完全确定以最有效的方式执行此操作.

//Photos fetch
PHFetchOptions *options = [[PHFetchOptions alloc] init];

options = [NSPredicate predicateWithFormat:@"mediaType == %d", PHAssetMediaTypeImage];
options.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]];

PHFetchResult *assetsFetchResults = [PHAsset fetchAssetsWithOptions:options];
Run Code Online (Sandbox Code Playgroud)

objective-c ios

2
推荐指数
1
解决办法
1285
查看次数

@mui/material with React 18 不起作用:在“react”中找不到导出“useContext”(导入为“useContext”)

当在 React 18.1.0 和 React-Dom 18.1.0 中使用 @mui/material 时,我遇到了情感和反应之间的一系列兼容性问题。这很奇怪,因为我实际上安装了最新版本的 React,所以我不完全确定是什么导致了这种情况。

WARNING in ./node_modules/@emotion/react/dist/emotion-element-cbed451f.browser.esm.js 12:41-54

export 'createContext' (imported as 'createContext') was not found in 'react' (possible exports: CacheProvider, ClassNames, Global, ThemeContext, ThemeProvider, __unsafe_useEmotionCache, createElement, css, jsx, keyframes, useTheme, withEmotionCache, withTheme)


WARNING in ./node_modules/@emotion/react/dist/emotion-element-cbed451f.browser.esm.js 28:9-19

export 'useContext' (imported as 'useContext') was not found in 'react' (possible exports: CacheProvider, ClassNames, Global, ThemeContext, ThemeProvider, __unsafe_useEmotionCache, createElement, css, jsx, keyframes, useTheme, withEmotionCache, withTheme)
Run Code Online (Sandbox Code Playgroud)

在 javascript 控制台上,我看到:

root.js:3049 Uncaught TypeError: (0 , react__WEBPACK_IMPORTED_MODULE_5__.createContext) is not a …
Run Code Online (Sandbox Code Playgroud)

reactjs webpack material-ui

2
推荐指数
1
解决办法
3459
查看次数

标签 统计

ios ×1

material-ui ×1

objective-c ×1

reactjs ×1

webpack ×1