IOS 9图标快速操作

  • 本文关键字:操作 图标 IOS 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>

不知怎的,当在下面添加这段代码时,当我试图运行项目时,或者当我试图使用"属性列表"打开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>

错误消息:

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

你知道这里可能出了什么问题吗?我已经尝试使用多个不同的代码,但仍然有错误。

在"常规"部分中将部署目标设置为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>

最新更新