我试图在我的iOS设备上传之前旋转视频,因为其他平台(例如android)无法正确解释iOS录制的视频中的旋转信息,因此,播放它们是不正确旋转的.
我查看了以下堆栈帖子,但没有成功将其中任何一个应用于我的案例:
我处理了Apple AVSimpleEditor项目示例,但遗憾的是,在创建AVAssetExportSession并调用exportAsynchronouslyWithCompletionHandler时,没有执行任何旋转,更糟糕的是,旋转元数据从生成的文件中被删除.
以下是运行导出的代码:
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:[_mutableComposition copy] presetName:AVAssetExportPresetPassthrough];
exportSession.outputURL = outputURL;
exportSession.outputFileType = AVFileType3GPP;
exportSession.shouldOptimizeForNetworkUse = YES;
exportSession.videoComposition = _mutableVideoComposition;
[exportSession exportAsynchronouslyWithCompletionHandler:^(void)
{
NSLog(@"Status is %d %@", exportSession.status, exportSession.error);
handler(exportSession);
[exportSession release];
}];
Run Code Online (Sandbox Code Playgroud)
此方法在此处初始化值_mutableComposition和_mutableVideoComposition:
- (void) getVideoComposition:(AVAsset*)asset
{
AVMutableComposition *mutableComposition = nil;
AVMutableVideoComposition *mutableVideoComposition = nil;
AVMutableVideoCompositionInstruction *instruction = nil;
AVMutableVideoCompositionLayerInstruction *layerInstruction = nil;
CGAffineTransform t1;
CGAffineTransform t2;
AVAssetTrack *assetVideoTrack = nil;
AVAssetTrack *assetAudioTrack = nil;
// Check …Run Code Online (Sandbox Code Playgroud) 我正在调试我在Docker容器中进行开发的问题,但是Jekyll在第一次编写之后没有正确更新静态HTML或CSS文件.我static_file.rb在第83行之后添加了以下代码:
sha256_src = Digest::SHA256.file path
sha256_dst = Digest::SHA256.file dest_path
fail "invalid file copy: #{path} / #{dest_path}" unless sha256_src == sha256_dst
Run Code Online (Sandbox Code Playgroud)
我发现失败是因为哈希不匹配而触发的.相反,path已将旧版本的静态文件复制到dest_path.我以为我正在失去理智,但我知道Docker使用分层文件系统,所以我想知道我是否遇到了某种bug或已知问题.
使用以下技术是否存在任何已知问题:
我不得不通过运行以下命令来解决它:
cp s5/*.css _site/s5/
cp s5/*.html _site/s5/
Run Code Online (Sandbox Code Playgroud)
而不是让它自动为我工作jekyll build.
以下是我将文件链接到docker镜像的方法:
export ABSPATH=$(cd "$(dirname "$0")"; cd ../; pwd)
docker run -d --name static -t -i -p 4000:4000 -p 2422:22 --link static-db:db -v "$ABSPATH:/mnt/app" me/static:0.0.2 /sbin/my_init --enable-insecure-key
Run Code Online (Sandbox Code Playgroud)
Docker版本:
Client:
Version: 1.8.3 …Run Code Online (Sandbox Code Playgroud) 您是否可以将rails配置为仅在特定环境下运行初始化程序?在我的情况下,我不得不破解paperclip在我的开发盒上使用Imagemagick,所以我有monkeypatched代码我只想应用于开发环境,而不是生产环境.该monkeypatch在config\initializers中保存为文件.
guides.rubyonrails.org网站并未表明可以执行此操作.如果我不能,我想我不会将这个补丁检查到我的回购中,但那不是理想的.
我将带有8GB内存的三星9系列SSD笔记本电脑更新到Windows 8.1后,(甚至不到一年,并且在去年11月购买时排名第一),我现在无法在调试WP8时运行Windows Phone模拟器应用程序.
我看到的错误消息是:
"系统中没有足够的内存来启动虚拟机模拟器WVGA 512MB.user,RAM大小为512兆字节"
好吧,在我尝试运行构建的瞬间,机器立即从消耗的25%内存消耗到80%.即使在我关闭Visual Studio Express 2012之后,仍然会根据任务管理器停留在80%的内存消耗.此时,我无法运行Windows Phone模拟器来测试我的应用程序.
如何在不更换硬件的情况下解决此问题?
谢谢!
我正在尝试使用gradle从命令行构建android-autofittextview项目.但是,每次出现以下错误都会失败:
/Users/me/android-autofittextview/library/src/main/java/me/grantland/widget/AutofitHelper.java:384: error: unknown tag: attr
* @attr ref android.R.styleable#TextView_textSize
Run Code Online (Sandbox Code Playgroud)
此错误在各种文件中重复十几次.
这发生在 :library:androidJavadocs
我尝试使用这种方法将其关闭,但是当我稍后尝试将其作为一个库项目时,我会得到一个"未知任务"异常.
当使用@attr标志时,如何使用Gradle正确构建javadoc?
我刚刚完成调试一个非常讨厌的UIViewController泄漏,这样即使在调用之后UIViewController也没有被释放dismissViewControllerAnimated.
我将问题跟踪到以下代码块:
self.dataSource.doNotAllowUpdates = YES;
[self.collectionView performBatchUpdates:^{
[self.collectionView reloadItemsAtIndexPaths:@[indexPath]];
} completion:^(BOOL finished) {
self.dataSource.doNotAllowUpdates = NO;
}];
Run Code Online (Sandbox Code Playgroud)
基本上,如果我调用performBatchUpdates然后立即调用dismissViewControllerAnimated,UIViewController会被泄露,并且永远不会调用dealloc它的方法UIViewController.UIViewController永远挂起.
有人可以解释这种行为吗?我假设performBatchUpdates运行超过一段时间间隔,比如500毫秒,所以我假设在上述间隔之后,它会调用这些方法,然后触发dealloc.
修复似乎是这样的:
self.dataSource.doNotAllowUpdates = YES;
__weak __typeof(self)weakSelf = self;
[self.collectionView performBatchUpdates:^{
__strong __typeof(weakSelf)strongSelf = weakSelf;
if (strongSelf) {
[strongSelf.collectionView reloadItemsAtIndexPaths:@[indexPath]];
}
} completion:^(BOOL finished) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
if (strongSelf) {
strongSelf.dataSource.doNotAllowUpdates = NO;
}
}];
Run Code Online (Sandbox Code Playgroud)
请注意,BOOL成员变量,, doNotAllowUpdates是我添加的变量,它在执行performBatchUpdates调用时阻止任何类型的dataSource/collectionView更新.
我在网上搜索关于我们是否应该使用weakSelf/strongSelf模式的讨论performBatchUpdates,但没有在这个问题上找到任何具体内容.
我很高兴我能够找到这个bug的底部,但我希望一个更聪明的iOS开发人员能够向我解释我所看到的这种行为.
memory-leaks objective-c uiviewcontroller ios uicollectionview
我们有一名成员报告他无法在我们的DatePickerDialog上设置1970年1月1日之前的日期.这个问题不适合我们.
我已经知道DatePickerDialog没有公开底层DatePicker的setMinDate/setMaxDate函数,所以看起来某种手机制造商特定的修改正在影响minDate/maxDate.
该用户报告说他正在运行2.2 Froyo的Verizon上运行Droid x2.虽然我们认为他对他的设备型号的描述是正确的,但许多用户对操作系统版本感到困惑,所以他可能正在运行2.3.
我试图通过将此主题添加到我的Activity来解决此问题:
<style name="profile_editor_theme">
<item name="android:endYear">2025</item>
<item name="android:startYear">1910</item>
</style>
Run Code Online (Sandbox Code Playgroud)
虽然我的活动中的这个主题具有在我的测试设备上限制DatePickerDialog的预期效果(Galaxy选项卡和原始的Motorola Droid),但它显然对用户没有影响.
这个问题在100%的时间内对我们的用户进行了重复,但在我们自己的设备上正常运行.
任何人都可以解释可能导致这种情况的原因以及如何解决这个问题?
谢谢!
在与Android集成的React Native 文档中,它包含用于与Android集成的代码段:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mReactRootView = new ReactRootView(this);
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModulePath("index")
.addPackage(new MainReactPackage())
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
mReactRootView.startReactApplication(mReactInstanceManager, "MyReactNativeApp", null);
setContentView(mReactRootView);
}
Run Code Online (Sandbox Code Playgroud)
但是,当我按原样使用它时,我得到一个100%的repro内存泄漏ThemedReactContext,ReactRootView这是由于持有对我的自定义活动的引用的引用.
这是因为Context传递给构造函数的参数ReactRootView是this,这是对我的自定义活动的引用.
相反,如果我这样做:
mReactRootView = new ReactRootView(getApplication());
Run Code Online (Sandbox Code Playgroud)
我没有内存泄漏.
为新的ReactRootView更改我的上下文源是否安全,这是一个应该a)修复还是b)应该看到文档发生变化的错误?
伙计们,
我在onCreate的顶部通过这样的代码片段捕获未处理的Android异常:
try {
File crashLogDirectory = new File(Environment.getExternalStorageDirectory().getCanonicalPath() + Constants.CrashLogDirectory);
crashLogDirectory.mkdirs();
Thread.setDefaultUncaughtExceptionHandler(new RemoteUploadExceptionHandler(
this, crashLogDirectory.getCanonicalPath()));
} catch (Exception e) {
if (MyActivity.WARN) Log.e(ScruffActivity.TAG, "Exception setting up exception handler! " + e.toString());
}
Run Code Online (Sandbox Code Playgroud)
我想在我的android应用程序中使用类似的二十几个AsyncTasks,因此捕获并记录了doInBackground中发生的未处理异常.
问题是,因为AsyncTask采用任意类型的初始化器,我不知道如何声明一个超类,我的所有AsyncTasks都继承了它,它设置了这个未处理的异常处理程序.
任何人都可以推荐一个好的设计模式来处理AsyncTask的doInBackground方法中的未处理异常,它不涉及每个新的AsyncTask定义的上述代码的复制和粘贴?
谢谢!
UPDATE
在仔细查看AsyncTask的来源之后,这是我使用的设计模式
import java.io.File;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Environment;
import android.util.Log;
public abstract class LoggingAsyncTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {
protected void setupUnhandledExceptionLogging(Context context) {
try {
File crashLogDirectory = new File(Environment.getExternalStorageDirectory().getCanonicalPath() + Constants.CrashLogDirectory);
crashLogDirectory.mkdirs();
Thread.setDefaultUncaughtExceptionHandler(new …Run Code Online (Sandbox Code Playgroud) java android exception unhandled-exception android-asynctask
.collectSwift 的组合中的操作将在哪个线程上发出预期的线程?
具体来说,我在第二个前提条件中看到此代码崩溃,但在第一个前提条件中没有崩溃:
return Publishers.MergeMany(publishers)
.handleEvents(receiveOutput: { _ in
precondition(Thread.isMainThread) // <- This is fine
})
.collect()
.handleEvents(receiveOutput: { _ in
precondition(Thread.isMainThread) // <- Crash is here
})
Run Code Online (Sandbox Code Playgroud)
就好像该.collect操作正在选择一个不同的线程来使用,即使最终的发布者必须MergeMany在主线程上发出。我通过从 Firebase 上传的崩溃日志推断出此行为。谁能解释这种观察到的行为?
android ×4
java ×3
ios ×2
memory-leaks ×2
combine ×1
datepicker ×1
docker ×1
exception ×1
gradle ×1
initializer ×1
javadoc ×1
jekyll ×1
objective-c ×1
orientation ×1
react-native ×1
ruby ×1
swift ×1
video ×1
windows-8.1 ×1