私は iPhone 開発と XCode 全般に比較的慣れていないため、CoreTelephony の問題のトラブルシューティングを開始する方法がわかりません。私は Java のバックグラウンドを持っているので、メモリ管理とポインタは私にとって少しさびています。さらに複雑なことに、iPhone プロジェクトを最後に見たとき、Objective-C ではアンロード時にオブジェクトを解放する必要がありましたが、これは変更されたようです。
ライブラリ: CoreTelephony.h、CoreTelephony.m を概念実証アプリで使用して、電話の imi 番号を取得しようとしています。
コードスニペット:
// Web ビューの Web アプリ URL を要求するコード [appView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:fullURL]]];
// Code to call apple's private core telephony framework
NSString *imei;
_CTServerConnectionCopyMobileIdentity(result, sc, &imei);
コードは Thread 1:EXC_BAD_ACCESS (code=13, address=0x0) エラーをスローしています: _CTServerConnectionCopyMobileIdentity(result, sc, &imei);
どんな助けでも感謝します。
CoreTelephony.h コード:
//
struct CTServerConnection
{
int a;
int b;
CFMachPortRef myport;
int c;
int d;
int e;
int f;
int g;
int h;
int i;
};
struct CTResult
{
int flag;
int a;
};
struct CTServerConnection * _CTServerConnectionCreate(CFAllocatorRef, void *, int *);
void _CTServerConnectionCopyMobileIdentity(struct CTResult *, struct CTServerConnection *, NSString **);
スタック ダンプ:
OS Version: iOS 6.0 (10A403)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 CoreTelephony 0x35c4ff46 0x35c14000 + 245574
1 CoreTelephony 0x35c5012a 0x35c14000 + 246058
2 AttendanceMonitor 0x00026c9e 0x24000 + 11422
3 UIKit 0x36282590 0x36260000 + 140688
4 UIKit 0x362c2d74 0x36260000 + 404852
5 UIKit 0x362beae8 0x36260000 + 387816
6 UIKit 0x363001cc 0x36260000 + 655820
7 AttendanceMonitor 0x000265e0 0x24000 + 9696
8 UIKit 0x362c3ad4 0x36260000 + 408276
9 UIKit 0x362c365e 0x36260000 + 407134
10 UIKit 0x362bb846 0x36260000 + 374854
11 UIKit 0x36263c3c 0x36260000 + 15420
12 UIKit 0x362636d0 0x36260000 + 14032
13 UIKit 0x3626311e 0x36260000 + 12574
14 GraphicsServices 0x343db5a0 0x343d5000 + 26016
15 GraphicsServices 0x343db1ce 0x343d5000 + 25038
16 CoreFoundation 0x33700170 0x33669000 + 618864
17 CoreFoundation 0x33700112 0x33669000 + 618770
18 CoreFoundation 0x336fef94 0x33669000 + 614292
19 CoreFoundation 0x33671eb8 0x33669000 + 36536
20 CoreFoundation 0x33671d44 0x33669000 + 36164
21 UIKit 0x362ba480 0x36260000 + 369792
22 UIKit 0x362b72fc 0x36260000 + 357116
23 AttendanceMonitor 0x00025ba4 0x24000 + 7076
24 libdyld.dylib 0x382f6b1c 0x382f5000 + 6940
Thread 1:
0 libsystem_kernel.dylib 0x323fad98 0x323e9000 + 73112
1 libsystem_c.dylib 0x377accf6 0x377a6000 + 27894
2 libsystem_c.dylib 0x377aca12 0x377a6000 + 27154
3 libsystem_c.dylib 0x377ac8a0 0x377a6000 + 26784
Thread 2 name: Dispatch queue: com.apple.libdispatch-manager
Thread 2:
0 libsystem_kernel.dylib 0x323ea648 0x323e9000 + 5704
1 libdispatch.dylib 0x37b134ec 0x37b02000 + 70892
2 libdispatch.dylib 0x37b05df4 0x37b02000 + 15860