有没有人知道TinyMCE 4中的valid_elements的默认规则集是否与TinyMCE 3中定义的默认规则集相同,因为TinyMCE 4的文档中缺少它(已经请求添加它).
valid_elements TinyMCE 4文档 - 缺少默认规则集
valid_elements TinyMCE 3文档 - 包括默认规则集
谢谢
我使用此代码将一些PDF数据保存到文件中,使用"打开方式"菜单将其发送到另一个应用程序,然后在完成后删除该文件:
- (void)openIn:(NSData *)fileData {
// save the PDF data to a temporary file
NSString *fileName = [NSString stringWithFormat:@"%@.pdf", self.name];
NSString *filePath = [NSString stringWithFormat:@"%@/Documents/%@", NSHomeDirectory(), fileName];
BOOL result = [fileData writeToFile:filePath atomically:TRUE];
if (result) {
NSURL *URL = [NSURL fileURLWithPath:filePath];
UIDocumentInteractionController *controller = [[UIDocumentInteractionController interactionControllerWithURL:URL] retain];
controller.delegate = self;
[controller presentOpenInMenuFromBarButtonItem:self.openInButton animated:TRUE];
}
}
- (void)documentInteractionControllerDidDismissOpenInMenu:(UIDocumentInteractionController *)controller {
// when the document interaction controller finishes, delete the temporary file
NSString *fileName = [NSString stringWithFormat:@"%@.pdf", self.name];
NSString *filePath = [NSString …Run Code Online (Sandbox Code Playgroud) timeInterval不断返回随机数.我认为每次通话时间隔会继续增加,但有时我会得到负数,有时会得到正数.
NSDate *date = groceryItem.lastPurchased;
double timeInterval = [date timeIntervalSinceNow];
cell.detailTextLabel.text = [NSString stringWithFormat:@"%d", timeInterval];
Run Code Online (Sandbox Code Playgroud) 我的应用程序允许用户通过单击一些格式按钮来格式化UITextView中的文本,这些按钮将属性应用于文本视图的attributedText属性.我想允许用户从一个UITextView复制他们的格式化文本,并使用标准剪贴板和标准剪切/复制/粘贴菜单将其粘贴到另一个.
目前,如果我从UITextView复制格式化文本并将其粘贴到Mail应用程序中的新邮件中,则格式化将保留 - 因此格式化文本的复制将自动进行.但是,如果我将格式化文本粘贴到我的应用程序中的另一个UITextView中,则仅显示纯文本.
通过遵循iOS文本编程指南中的"粘贴选择"部分,我能够覆盖UITextView的粘贴方法并拦截粘贴的内容:
- (void)paste:(id)sender {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
NSLog(@"types available: %@", [pasteboard pasteboardTypes]);
for (NSString *type in [pasteboard pasteboardTypes]) {
NSLog(@"type %@ (%@): %@", type, NSStringFromClass([[pasteboard valueForPasteboardType:type] class]), [pasteboard valueForPasteboardType:type]);
}
}
Run Code Online (Sandbox Code Playgroud)
这告诉我,粘贴板包含以下格式的内容:com.apple.rtfd,public.rtf,public.text和"Apple Web Archive粘贴板类型".文本的值是纯文本字符串,rtf的值是RTF字符串,两种Apple格式的值是NSData.
这就是我被困住的地方.如何将其中一个项目从粘贴板数据转换为为UITextView设置的属性字符串?
或者更好的是,有没有办法配置UITextView在粘贴时自动接受格式化文本,就像它在复制时自动提供格式化文本一样?
我有一个健身应用程序,可以接收位置更新,并且自iOS 4以来一直在后台工作正常.我只是注意到,当iOS中的应用程序移动到后台(切换应用程序或锁定设备)时,位置更新会停止.我没有发现任何功能或背景权限变更的通知; 有谁知道发生了什么?
我的位置设置非常基本:
if (!self.locationManager) {
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
self.locationManager.distanceFilter = kCLDistanceFilterNone;
self.locationManager.activityType = CLActivityTypeFitness;
self.locationManager.pausesLocationUpdatesAutomatically = TRUE;
}
// request permissions on iOS 8+
if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
[self.locationManager requestWhenInUseAuthorization];
}
Run Code Online (Sandbox Code Playgroud)
然后这个回调接收更新:
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
DLog(@"didUpdateToLocation");
}
Run Code Online (Sandbox Code Playgroud)
当应用程序处于前台时,一切都很好.一旦移动到后台,此消息就会出现在控制台中:
/BuildRoot/Library/Caches/com.apple.xbs/Sources/ExternalAccessory/ExternalAccessory-353.22.1/EAAccessoryManager.m:__52-[EAAccessoryManager _checkForConnectedAccessories:]_block_invoke-785 ending background task
Run Code Online (Sandbox Code Playgroud)
然后更新停止.当我将应用程序带到前台时,它们会再次恢复.
我没有直接使用EAAccessoryManager,只能猜测它是什么.我正在使用BluetoothLE框架从心率监视器接收数据,但是当我禁用此功能(停止实例化BluetoothLE对象)时,问题仍然存在.
我UIBackgroundModes分别设置location,external-accessory并且bluetooth-central因为我也有卵石手表连接.我尝试添加,bluetooth-peripheral但没有帮助.我也有,NSLocationWhenInUseUsageDescription并NSBluetoothPeripheralUsageDescription设置,这些都在工作.
我的PHP Web应用程序中的所有MySQL表都是具有utf8编码的MyISAM。由于可以在离线状态下通过配套应用生成记录,因此我的表键是随机生成的字母数字VARCHAR;这些字段使用utf8_bin编码设置为二进制,因此它们区分大小写。
我最近决定更改我所有文本字段的编码,以支持某些用户喜欢输入的表情符号。我继续将所有utf8字段更改为utf8mb4,包括密钥。我立即开始发现性能问题,其中对一个较大的表进行复杂的SELECT查询要花费一分钟多的时间,然后其他查询排队等待表锁。我将该表上的主键字段的编码改回了utf8,性能恢复了正常。几天后,我再次将该字段更改为utf8mb4,查询再次开始排队,然后将其更改为恢复正常性能。
因此,运行顺利:
`ID` varchar(8) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT ''
Run Code Online (Sandbox Code Playgroud)
但这会导致问题:
`ID` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT ''
Run Code Online (Sandbox Code Playgroud)
我读过的所有内容都说utf8和utf8mb4应该具有同等的性能,但是我发现我的情况有明显的不同。这有意义吗?
将关键字段保留在utf8并不是一个真正的问题,因为我预见在那里不会再使用简单的字母数字字符。但是我希望将所有字段都设置为相同的编码,只是为了保持一致和简化维护(不必记住将用户填充的字段设置为一种编码,而将关键字段设置为另一种编码)。
关于@MandyShaw的评论
当我使用Sequel Pro Mac应用程序处理数据库时,控制台会不断显示成对的SET NAMES 'utf8'和SET NAMES 'utf8mb4'条目,因此这表明并非所有设置都正确。但是,这是我目前所拥有的:
MySQL [(none)]> SHOW GLOBAL VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
+--------------------------+--------------------+
| Variable_name | Value |
+--------------------------+--------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary …Run Code Online (Sandbox Code Playgroud) 我在UIViewController确认以下代码中有此代码UIDocumentPickerDelegate:
- (void)openTextFilePicker {
NSArray *UTIs = [NSArray arrayWithObjects:@"public.text", nil];
[self openFilePicker:UTIs];
}
- (void)openFilePicker:(NSArray *)UTIs {
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:UTIs inMode:UIDocumentPickerModeImport];
documentPicker.delegate = self;
documentPicker.popoverPresentationController.barButtonItem = self.importButton;
[self presentViewController:documentPicker animated:TRUE completion:nil];
}
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURLs:(NSArray<NSURL *> *)urls {
[self documentPicker:controller didPickDocumentAtURL:[urls firstObject]];
}
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url {
NSLog(@"picked document %@", url);
}
- (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller {
NSLog(@"cancelled");
}
Run Code Online (Sandbox Code Playgroud)
这在 iOS 中运行良好。在 Mac Catalyst 中,文件选择器打开,我可以导航和选择一个文件,但是当我单击选择器中的打开按钮时,既不调用didPickDocumentAtURLs也不didPickDocumentAtURL调用。但是,如果我单击选择器中的取消按钮,documentPickerWasCancelled则会调用。 …
我从MPMediaPickerController获取媒体项的ID.根据文档,此值是包含uint64_t(unsigned long long)的NSNumber对象.我想将其转换为NSString以保存在我的数据模型中.但是,当我将其转换为字符串时,其值会发生变化,当我将其转换回数字时,它会再次更改!显然,我对这些数据类型并不了解.你能帮我吗?
MPMediaItem *mediaPicked;
// set mediaPicked to an MPMedia item using MPMediaPickerController...
NSLog(@"id as number: %qu", [mediaPicked valueForProperty:MPMediaItemPropertyPersistentID]); // outputs 566042331449280
NSLog(@"id as string: %@", [[mediaPicked valueForProperty:MPMediaItemPropertyPersistentID] stringValue]); // outputs 16204893883745507648
NSLog(@"id as number: %qu", [[[mediaPicked valueForProperty:MPMediaItemPropertyPersistentID] stringValue] longLongValue]); // outputs 9223372036854775807
Run Code Online (Sandbox Code Playgroud)
如果我尝试在此转换之前播放媒体项目,它始终有效.但是如果我在转换后尝试播放媒体项目,那么我尝试过的媒体项目中只有大约一半可以使用.因此,一些ID值在转换后仍然存在,而另一些则没有.
我正在使用Apple的MixerHost示例项目,该项目设置了一个音频单元处理图,其中包含一个连接到远程I/O音频单元的多声道混音器音频单元.我试图在两者之间放置一个格式转换器音频单元,这样我就可以转换混音器输出的格式.
复制两个现有音频单元的设置似乎很简单,当我输出图形设置时,它看起来是正确的:
Member Nodes:
node 1: 'auou' 'rioc' 'appl', instance 0x1cdf10 O
node 2: 'aufc' 'conv' 'appl', instance 0x1ce890 O
node 3: 'aumx' 'mcmx' 'appl', instance 0x1ceba0 O
Connections:
node 3 bus 0 => node 2 bus 1
node 2 bus 0 => node 1 bus 0 [ 2 ch, 0 Hz, 'lpcm' (0x0000000C) 16-bit little-endian signed integer]
Run Code Online (Sandbox Code Playgroud)
但是,当我初始化图形时,我得到错误-10877,无效元素,图形无法启动.任何人都可以看到什么是错的?这是完整的设置代码:
NSLog (@"Configuring and then initializing audio processing graph");
OSStatus result = noErr;
//............................................................................
// Create a new audio processing graph.
result …Run Code Online (Sandbox Code Playgroud) 我有一个方法在意外的时间在我的iPhone应用程序中调用,我无法弄清楚调用它的代码.有没有办法从Objective C方法或Xcode功能中找到它?基本上...
- (void)myMethod {
NSLog(@"who just called me?");
}
Run Code Online (Sandbox Code Playgroud)
这个方法是从我的代码中的很多地方调用的,所以只搜索方法名称并不能缩小范围.我可以暂时向方法添加一个参数,然后编辑对该方法的每个调用,以添加一个唯一的标识符作为参数,但这需要大量编辑,然后在我完成时撤消所有编辑.
理想情况下,我会找到调用此方法的代码的类和行号.我不需要在方法中使用此信息,我只需要它进行调试.
我正在更新我的Android应用以支持Android 7中的多窗口模式.由于应用已经在onConfigurationChanged中处理旋转更改,我想以相同的方式处理窗口大小更改.所以,我已经更新了AndroidManifest.xml以包含android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout"我的活动.
这在调整窗口大小时按预期工作,因此我的应用程序占用屏幕的2/3或1/2:调用onConfigurationChanged,并且我的活动未重新启动.但是,当我将我的应用程序调整到1/3屏幕大小时(因此我的应用程序仅占用屏幕的1/3而另一个应用程序占用剩余的2/3),该应用程序的行为就好像我没有那些configChanges值:未调用onConfigurationChanged,并重新启动我的活动.
我检查了configChanges的可能值,但没有看到任何其他看起来相关的值.
是否有任何理由以这种方式工作,或者这是一个Android错误?我在Google Pixel C平板电脑上运行Android 7.1.2.
我正在将一些 Java 应用程序移植到 Kotlin,但我一直在使用哈希图遇到这个问题。假设我有两个哈希图:
var firstHashmap: HashMap<String, String> = hashMapOf("foo" to "A", "bar" to "B")
var secondHashmap: HashMap<String, String> = hashMapOf("foo" to "C", "bar" to "D")
Run Code Online (Sandbox Code Playgroud)
如果另一个中存在相同的密钥,我想更新一个:
if (firstHashmap["foo"] != null) {
secondHashmap["foo"] = firstHashmap["foo"]
}
Run Code Online (Sandbox Code Playgroud)
Kotlin 不会编译第二行,因为firstHashmap不能保证有“foo”键。我只是在第一行检查它并不重要 - 智能转换系统显然不适用于 hashmap 键。这有同样的问题:
if (firstHashmap.containsKey("foo")) {
secondHashmap["foo"] = firstHashmap["foo"]
}
Run Code Online (Sandbox Code Playgroud)
这有效,但在某些情况下创建额外变量会变得混乱:
val newValue = firstHashmap["foo"]
if (newValue != null) {
secondHashmap["foo"] = newValue
}
Run Code Online (Sandbox Code Playgroud)
这也有效,但到目前为止我从未使用过!!修饰符:
if (firstHashmap["foo"] != null) {
secondHashmap["foo"] = firstHashmap["foo"]!!
}
Run Code Online (Sandbox Code Playgroud)
这行得通,但是 Elvis 运算符后面的默认值永远不会被使用,只是为了满足编译器,感觉不对: …
ios ×6
objective-c ×4
iphone ×2
android ×1
audioformat ×1
audiounit ×1
cocoa-touch ×1
copy-paste ×1
core-audio ×1
filesystems ×1
ios4 ×1
kotlin ×1
mac-catalyst ×1
mysql ×1
nsdata ×1
nullable ×1
php ×1
richtext ×1
tinymce-4 ×1
types ×1
uidocumentpickerviewcontroller ×1
uitextview ×1
unicode ×1
xcode ×1