小编Kiv*_*olf的帖子

在iPad3上旋转/ 2x之前,应用程序不会响应

我想知道是否有其他人发生过这种情况.我有一个iPhone应用程序,我已经更新超过一年,它已经在我的iPad2,iPhone 3GS,以及4G,4GS和5上工作得很好.但是,就在最近我获得了一个iPad3来测试应用程序.发生了一件非常奇怪的事情:当应用程序通过Xcode在开发中加载时,它会出现并且看起来很完美 - 但是,它根本不会响应任何触摸.我有一个警告,在加载时弹出,你可以关闭它,但实际的主视图控制器不会对任何拖动或触摸手势作出反应 - 它基本上是冻结的.然而!当我旋转设备并且App正确旋转时,它突然开始正常工作,即使我把它旋转回来!在正常和视网膜上运行iOS6的iPad的模拟器也做同样的事情,即使它在我的iPad2上工作得很好.但是,iPhone的模拟器工作得很好.

就像我说的,这不会发生在任何其他设备上.即使以相同的方式加载所有设备也允许像正常一样轻敲.以下是我能够确认的内容:

  • iPad3设备:冷冻
  • iPad-retina sim:冷冻
  • iPad-normal sim:冻结
  • iPad2设备:正常
  • iPhone-retina sim:正常
  • iPhone-normal sim:正常
  • iPhone 4S设备:正常
  • iPhone 4设备:正常

如果所有的iPhone都能正常工作且iPad没有,那么这将是有道理的.但我的ipad2工作正常.另外,如果我使用iPad3打开它,它就会冻结.但!如果我按下2X按钮,即使没有旋转,它也会再次开始工作.

我还决定测试它是否可以作为通用应用程序.在iPad3上,当我将它切换到Universal时,它可以正常工作.因此,模拟器必须进行一些奇怪的事情.有任何想法吗?

谢谢!!

-标记

iphone objective-c ipad screen-rotation ios

8
推荐指数
1
解决办法
604
查看次数

Python PIL:转换 RGBA->P - ValueError:图像模式错误

使用 Python Imaging Library (PIL) 我得到:

"ValueError: image has wrong mode"
Run Code Online (Sandbox Code Playgroud)

when trying to convert an RGBA mode image to a P mode image. I couldn't find any evidence for the fact that it is possible. The material I found on the convert() method doesn't state that it isn't possible. I am wondering if I am doing something wrong or if this is just not possible.

Here is my code:

from PIL import Image

transImage = Image.open("transparent_8_bit.png")
print transImage.mode

transImageRGBA …
Run Code Online (Sandbox Code Playgroud)

python png python-imaging-library

6
推荐指数
0
解决办法
2220
查看次数

自定义 UTI 未在应用程序中打开

我正在尝试为我的应用程序创建一个新文档 UTI,以便人们可以与他人分享兴趣点。根据我对 SO、教程和 Apple 文档的了解,您需要执行以下操作:

  1. 在 .plist 中创建文档类型
  2. 创建与其对应的导出 UTI
  3. 使用方法:-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

据我所知,只要你做对了,你应该能够通过邮件打开文件而不会出现任何问题。不幸的是,它不适用于我自己的自定义 UTI。我确实在邮件的“打开方式...”列表中看到了我的应用程序,但是当我选择它时,我的应用程序根本没有打开。不仅在应用程序未打开时,而且在应用程序打开时,它都不做任何事情。邮件保持正常,什么也没有发生。我还使用“组织者”检查了控制台,绝对没有发生任何事情。

最初我认为我的 plist 是错误的,所以我测试了打开一个公共 UTI(我添加了 com.adobe.pdf 文档类型)并且我的应用程序启动得很好(尽管它很快崩溃了,因为我实际上并不支持 PDF ;))。但关键是它启动时没有任何问题。

我唯一能想到的可能是我如何创建文件的问题。我正在使用此方法(也在要导出的应用程序中)在电子邮件中创建文件:

MFMailComposeViewController *picker = [[[MFMailComposeViewController alloc] init] autorelease];
[picker setSubject:[NSString stringWithFormat:@"My place: %@",POIName]];
[picker addAttachmentData:customPOIData mimeType:@"application/customPOI" fileName:[NSString stringWithFormat:@"%@.icp",POIName]];
[picker setMessageBody:@"Check out this great place I found!" isHTML:NO];
[picker setMailComposeDelegate:self];
[self presentModalViewController:picker animated:YES];
Run Code Online (Sandbox Code Playgroud)

有什么问题吗?

另外,这是我的 plist 代码:

CFBundleDocumentTypes:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeIconFiles</key>
        <array/>
        <key>CFBundleTypeName</key>
        <string>Custom POI</string>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>LSHandlerRank</key>
        <string>Owner</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.imadev.icp</string>
        </array>
    </dict>
</array>
Run Code Online (Sandbox Code Playgroud)

UTExportedType …

types document objective-c uti ios5

5
推荐指数
1
解决办法
2176
查看次数

NSDateFormatter似乎有错误的月份

我有这个代码块来读取ISO 8601日期/时间规范.问题是由于某种原因,月份不起作用.我每次转换月份都是"01".我究竟做错了什么?

NSDateFormatter *UTCDateFormat = [[NSDateFormatter alloc] init];
[UTCDateFormat setDateFormat:@"yyyy-MM-DD'T'HH:mm:ss'Z'"];
[UTCDateFormat setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]];
[UTCDateFormat setCalendar:[[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease]];
[UTCDateFormat setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease]];
NSLog(@"%@", [UTCDateFormat dateFromString:dateString]);
Run Code Online (Sandbox Code Playgroud)

因此,例如,如果dateString是:

@"2002-03-12T21:13:27Z" 
Run Code Online (Sandbox Code Playgroud)

我的输出是:

2002-01-12 21:13:27 +0000
Run Code Online (Sandbox Code Playgroud)

我已经尝试过的事情:

  • 将MM更改为LL
  • 没有setCalendar/setLocale尝试
  • 试过'围绕 -
  • MM转换到其他地方的位置.它从不改变任何东西.
  • 看着所有的SO,它似乎适用于其他所有人.

objective-c iso8601 nsdateformatter

5
推荐指数
1
解决办法
1663
查看次数

如何使用JavaScript for Automation在脚本编辑器中登录消息窗口

"自动化JavaScript"在OSX Yosemite中是全新的.我不熟悉AppleScript,因为我不太喜欢它的冗长程度.但Javascript看起来很棒!但是,我无法弄清楚如何将调试消息发送到ScriptEditor的消息窗口!我到处寻找......这可能吗?这样做的代码是什么?

我试过了:

console.log("Hello World");

但这不起作用.有任何想法吗?这应该是这么简单!

注意:这不是HTML/Javascript问题.我在OSX中使用Javascript语言而不是AppleScript来讨论名为"脚本编辑器"的应用程序.我会用"脚本编辑器"标记这个问题,但是不允许我标记.

javascript osx-yosemite

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