1

iPad アプリで本当に奇妙な動作に直面しています。いくつかのバンドルを作成すると、アプリはそれらをダウンロードしてドキュメント ディレクトリに保存します。

このようなバンドルをロードできるカスタム バンドル マネージャーがあります。

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

NSString *bundlePath;
if (![bundleName hasSuffix:@".bundle"]) {
    bundlePath = [documentsDirectory stringByAppendingFormat:@"/%@.bundle", bundleName];
} else {
    bundlePath = [documentsDirectory stringByAppendingFormat:@"/%@", bundleName];
}
NSBundle *bundle = nil;
NSError *error = nil;

bundle = [[NSBundle alloc] initWithPath:bundlePath];
if (!bundle) {
    return nil;
}
[bundle loadAndReturnError:&error];

デバッグ モードでは、すべてのコードが魅力的に機能します。バンドルが読み込まれ、アプリでコンテンツを使用できるようになります。バンドルには画像とペン先が含まれ、コードは含まれません。バンドルのビルド設定で、画像が tiff 画像として結合されないように、COMBINE_HIDPI_IMAGESNOに設定しました。バンドルにはコードも含まれていません。

だから問題は何ですか。デバッグせずに (Xcode に接続せずに) アプリを起動すると、アプリがクラッシュし、このエラー メッセージが生成されます。[bundle loadAndReturnError:&error]は、コードがクラッシュする場所です。

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   dyld                            0x2fe8e2d8 strcmp + 0
1   dyld                            0x2fe83aac ImageLoaderMachO::parseLoadCmds() + 56
2   dyld                            0x2fe88d30 ImageLoaderMachOCompressed::instantiateFromFile(char const*, int, unsigned char const*, unsigned long long, unsigned long long, stat const&, unsigned int, unsigned int, linkedit_data_command const*, ImageLoader::LinkContext const&) + 296
3   dyld                            0x2fe839c6 ImageLoaderMachO::instantiateFromFile(char const*, int, unsigned char const*, unsigned long long, unsigned long long, stat const&, ImageLoader::LinkContext const&) + 222
4   dyld                            0x2fe7b0d4 dyld::loadPhase6(int, stat const&, char const*, dyld::LoadContext const&) + 664
5   dyld                            0x2fe7e774 dyld::loadPhase5stat(char const*, dyld::LoadContext const&, stat*, int*, bool*, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 428
6   dyld                            0x2fe7e498 dyld::loadPhase5(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 248
7   dyld                            0x2fe7e37c dyld::loadPhase4(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 128
8   dyld                            0x2fe7e29c dyld::loadPhase3(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 984
9   dyld                            0x2fe7dc36 dyld::loadPhase1(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 110
10  dyld                            0x2fe7ada4 dyld::loadPhase0(char const*, char const*, dyld::LoadContext const&, std::__1::vector<char const*, std::__1::allocator<char const*> >*) + 168
11  dyld                            0x2fe7ab58 dyld::load(char const*, dyld::LoadContext const&) + 208
12  dyld                            0x2fe7f8da dlopen + 802
13  libdyld.dylib                   0x39dee946 dlopen + 46
14  CoreFoundation                  0x31ab4910 _CFBundleDlfcnLoadBundle + 128
15  CoreFoundation                  0x31ab478c _CFBundleLoadExecutableAndReturnError + 356
16  Foundation                      0x323d2154 -[NSBundle loadAndReturnError:] + 844
17  Visitor Self Service            0x000e251a -[CoreBundleManager bundleForName:] (CoreBundleManager.m:70)
18  Visitor Self Service            0x000cd418 -[CoreProcessDefinition processBundle] (CoreProcessDefinition.m:226)
19  Visitor Self Service            0x000cf17e -[CoreProcessRuntime loadControllerForStep:] (CoreProcessRuntime.m:187)
20  Visitor Self Service            0x000ce9f4 -[CoreProcessRuntime performNextStepInProcessDefinition] (CoreProcessRuntime.m:112)
21  Visitor Self Service            0x000ba642 __62-[DynamicViewController prepareControllerForProcessDefinition]_block_invoke (DynamicViewController.m:107)
22  libdispatch.dylib               0x39ddb790 _dispatch_call_block_and_release + 8
23  libdispatch.dylib               0x39dde8be _dispatch_after_timer_callback + 10
24  libdispatch.dylib               0x39ddb5d8 _dispatch_client_callout + 20
25  libdispatch.dylib               0x39ddc48a _dispatch_source_invoke + 254
26  libdispatch.dylib               0x39ddee04 _dispatch_main_queue_callback_4CF + 164
27  CoreFoundation                  0x31afb1ac __CFRunLoopRun + 1284
28  CoreFoundation                  0x31a6e238 CFRunLoopRunSpecific + 352
29  CoreFoundation                  0x31a6e0c4 CFRunLoopRunInMode + 100
30  GraphicsServices                0x35629336 GSEventRunModal + 70
31  UIKit                           0x3398a2b4 UIApplicationMain + 1116
32  Visitor Self Service            0x000b66d8 main (main.m:16)
33  libdyld.dylib                   0x39deeb1c start + 0
4

1 に答える 1

2

最後に、私はそれを機能させました。

適切なバンドルを設定するには、いくつかの手順があります。

バンドル セットのプロジェクト ビルド設定

  • アーキテクチャ => armv7、armv7s
  • 対応プラットフォーム => iOS
  • 有効なアーキテクチャ => armv7、armv7s
  • 有効な Code Sign ID を設定する
  • 一致するプロビジョニング プロファイルを設定する

Info.plist も必要です

  • 必要なデバイス機能 => armv7、armv7s
  • プリンシパル クラス => バンドルのプリンシパル クラス名
  • 実行可能ファイル => プリンシパル クラスと同じ

ノート

外部コードの実行はApple Review Guidelinesで禁止されているため、インハウス アプリでのみ可能です。

2.7何らかの方法または形式でコードをダウンロードするアプリは拒否されます

2.8他の実行可能コードをインストールまたは起動するアプリは拒否されます

于 2013-12-28T19:36:26.157 に答える