IOS 9 Quick Action for icon

时间:2015-12-02 23:26:04

标签: ios

我正在尝试在我的图标上使用3D Touch时添加“快速操作”菜单。我的info.plist看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>0.3</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>3</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UIBackgroundModes</key>
    <array>
        <string>remote-notification</string>
    </array>
    <array>
        <dict>
            <key>UIApplicationShortcutItemIconType</key>
            <string>UIApplicationShortcutIconTypeAdd</string>
            <key>UIApplicationShortcutItemTitle</key>
            <string>Home</string>
            <key>UIApplicationShortcutItemType</key>
            <string>quickactions.sweefties.home</string>
        </dict>
        <dict>
            <key>UIApplicationShortcutItemIconFile</key>
            <string>videow</string>
            <key>UIApplicationShortcutItemSubtitle</key>
            <string>Launch video..</string>
            <key>UIApplicationShortcutItemTitle</key>
            <string>Movies</string>
            <key>UIApplicationShortcutItemType</key>
            <string>quickactions.sweefties.movies</string>
        </dict>
        <dict>
            <key>UIApplicationShortcutItemIconType</key>
            <string>UIApplicationShortcutIconTypeShare</string>
            <key>UIApplicationShortcutItemTitle</key>
            <string>Share</string>
            <key>UIApplicationShortcutItemType</key>
            <string>quickactions.sweefties.share</string>
        </dict>
        <dict>
            <key>UIApplicationShortcutItemIconType</key>
            <string>UIApplicationShortcutIconTypeCompose</string>
            <key>UIApplicationShortcutItemTitle</key>
            <string>Message</string>
            <key>UIApplicationShortcutItemType</key>
            <string>quickactions.sweefties.message</string>
        </dict>
    </array>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UIStatusBarStyle</key>
    <string>UIStatusBarStyleLightContent</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
</dict>
</plist>

不知何故,在下面添加此代码时,它会在尝试运行项目时或尝试使用&#34;属性列表&#34;打开info.plist时给出错误。

<array>
        <dict>
            <key>UIApplicationShortcutItemIconType</key>
            <string>UIApplicationShortcutIconTypeAdd</string>
            <key>UIApplicationShortcutItemTitle</key>
            <string>Home</string>
            <key>UIApplicationShortcutItemType</key>
            <string>quickactions.sweefties.home</string>
        </dict>
        <dict>
            <key>UIApplicationShortcutItemIconFile</key>
            <string>videow</string>
            <key>UIApplicationShortcutItemSubtitle</key>
            <string>Launch video..</string>
            <key>UIApplicationShortcutItemTitle</key>
            <string>Movies</string>
            <key>UIApplicationShortcutItemType</key>
            <string>quickactions.sweefties.movies</string>
        </dict>
        <dict>
            <key>UIApplicationShortcutItemIconType</key>
            <string>UIApplicationShortcutIconTypeShare</string>
            <key>UIApplicationShortcutItemTitle</key>
            <string>Share</string>
            <key>UIApplicationShortcutItemType</key>
            <string>quickactions.sweefties.share</string>
        </dict>
        <dict>
            <key>UIApplicationShortcutItemIconType</key>
            <string>UIApplicationShortcutIconTypeCompose</string>
            <key>UIApplicationShortcutItemTitle</key>
            <string>Message</string>
            <key>UIApplicationShortcutItemType</key>
            <string>quickactions.sweefties.message</string>
        </dict>
    </array>

错误讯息:

  

无法读取数据,因为格式不正确。

任何想法在这里可能有什么问题?我尝试过使用多个不同的代码,但仍然出错。

1 个答案:

答案 0 :(得分:2)

在“常规”部分中将部署目标设置为9.0。

然后尝试用info.plist中的代码替换你的代码。

<key>UIApplicationShortcutItems</key>
    <array>
        <dict>
            <key>UIApplicationShortcutItemIconType</key>
            <string>UIApplicationShortcutIconTypeAdd</string>
            <key>UIApplicationShortcutItemTitle</key>
            <string>Home</string>
            <key>UIApplicationShortcutItemType</key>
            <string>quickactions.sweefties.home</string>
        </dict>
        <dict>
            <key>UIApplicationShortcutItemIconFile</key>
            <string>videow</string>
            <key>UIApplicationShortcutItemSubtitle</key>
            <string>Launch video..</string>
            <key>UIApplicationShortcutItemTitle</key>
            <string>Movies</string>
            <key>UIApplicationShortcutItemType</key>
            <string>quickactions.sweefties.movies</string>
        </dict>
        <dict>
            <key>UIApplicationShortcutItemIconType</key>
            <string>UIApplicationShortcutIconTypeShare</string>
            <key>UIApplicationShortcutItemTitle</key>
            <string>Share</string>
            <key>UIApplicationShortcutItemType</key>
            <string>quickactions.sweefties.share</string>
        </dict>
        <dict>
            <key>UIApplicationShortcutItemIconType</key>
            <string>UIApplicationShortcutIconTypeCompose</string>
            <key>UIApplicationShortcutItemTitle</key>
            <string>Message</string>
            <key>UIApplicationShortcutItemType</key>
            <string>quickactions.sweefties.message</string>
        </dict>
    </array>