小编Sha*_*anu的帖子

如何将设备令牌从AppDelegate传递到UIViewController

嗨,在我的应用程序中我正在获取设备令牌,我正在传递给我的服务器现在发送通知我想发送个人通知我需要获取设备令牌表格我UIViewController请告诉是否有任何可能获取设备令牌形成Appdelegate或来自UIViewController

我在中获取设备令牌的代码 Appdelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeNone)];
     return YES;
}
Run Code Online (Sandbox Code Playgroud)

设备令牌.

-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
   {
      const char* data = [deviceToken bytes];
      NSMutableString * token = [NSMutableString string];

    for (int i = 0; i < [deviceToken length]; i++) {
       [token appendFormat:@"%02.2hhX", data[i]];
    }

   NSString *urlString = [NSString stringWithFormat:@"url?token=%@",token];

   NSURL *url = [[NSURL alloc] initWithString:urlString];
   NSLog(@"token %@",urlString);


   NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
   NSLog(@"request %@ ",urlRequest);
   NSData *urlData; …
Run Code Online (Sandbox Code Playgroud)

uiviewcontroller devicetoken ios

4
推荐指数
1
解决办法
4827
查看次数

架构armv7 IOS 7的未定义符号

嗨我正在尝试在我的应用程序中创建路由映射我得到了一些类文件来实现路由映射,所以我导入到我的项目后导入此问题显示这样的错误.

      Undefined symbols for architecture armv7:
      "_uregex_end", referenced from:
      _rkl_performRegexOp in RegexKitLite.o
      _rkl_search in RegexKitLite.o
      _rkl_findRanges in RegexKitLite.o
     "_uregex_appendReplacement", referenced from:
      _rkl_replaceAll in RegexKitLite.o
     "_uregex_groupCount", referenced from:
     _rkl_getCachedRegex in RegexKitLite.o
     "_uregex_appendTail", referenced from:
     _rkl_replaceAll in RegexKitLite.o
     "_u_strlen", referenced from:
    _rkl_userInfoDictionary in RegexKitLite.o
     "_uregex_reset", referenced from:
    _rkl_replaceAll in RegexKitLite.o
     "_uregex_close", referenced from:
    _rkl_clearCacheSlotRegex in RegexKitLite.o
     "_u_errorName", referenced from:
   _rkl_NSExceptionForRegex in RegexKitLite.o
   _rkl_userInfoDictionary in RegexKitLite.o
    "_uregex_findNext", referenced from:
   _rkl_search in RegexKitLite.o
   _rkl_replaceAll in RegexKitLite.o
    "_uregex_setText", referenced from:
   _rkl_clearCacheSlotSetTo in RegexKitLite.o
   _rkl_setCacheSlotToString in …
Run Code Online (Sandbox Code Playgroud)

armv7 ios

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

命令/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang失败并退出

我在申请中遇到以下错误.

    clang: error: no such file or directory: '/Users/madhavadudipalli/Desktop/ ios projects/Little Flower Public School /Little Flower Public School Ipad/Little Flower Public S  chool HD-Prefix*.pch'
    clang: error: no input files
    Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
Run Code Online (Sandbox Code Playgroud)

请告诉我这是什么意思,我该怎么做才能解决这个问题.有一段时间以来我一直坚持这个.请指导我在哪里出错.

提前致谢.

xcode objective-c ios swift

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

尝试创建sqlite数据库时遇到错误'无法创建表'IOS7

嗨,在我的应用程序中我正在尝试创建一个本地数据库来存储具有主键自动增量值的值,但它给出的错误就像.

2014-06-19 14:34:28.499 brt[2363:80b] *** Assertion failure in -[listviewpoliticalViewController createTable:withField1:withField2:withField3:withField4:], /Users/madhavadudipalli/Desktop/ ios projects/brt/brt/listviewpoliticalViewController.m:37

2014-06-19 14:34:28.501 brt[2363:80b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not create table'
Run Code Online (Sandbox Code Playgroud)

我收到如上所述的错误请告诉我如何解决此问题.

我的数据库在.h文件中创建代码.

    -(NSString *) filePath;
    -(void)openDB;

    -(void) createTable: (NSString *) tableName
        withField1:(NSString *) field1
        withField2:(NSString *) field2
        withField3:(NSString *) field3
        withField4:(NSString *) field4;
Run Code Online (Sandbox Code Playgroud)

.m文件中的数据库代码.

     -(void) createTable: (NSString *) tableName
         withField1:(NSString *) field1
         withField2:(NSString *) field2
         withField3:(NSString *) field3
        withField4:(NSString *) field4;
   {
     char *err;
     NSString *sql =[NSString stringWithFormat:@"CREATE TABLE IF NOT …
Run Code Online (Sandbox Code Playgroud)

sqlite insert ios

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

Swift:如何使用服务器SSL证书进行Https请求

嗨,我想在Swift中发出Https请求.目前我通过ip地址访问本地服务器.本地服务器有一个SSL证书,通过访问证书想要向服务器发出请求,目前即时这样做.

  Alamofire.request(.GET, https://ipaddress//, parameters: [param], headers: headers)
        .responseJSON { response in
            print(response.request)  // original URL request
            print(response.response) // URL response
            print(response.data)     // server data
            print(response.result)   // result of response serialization

            if let JSON = response.result.value {
                print("JSON: \(JSON)")


            }
    }
Run Code Online (Sandbox Code Playgroud)

我已经使用上面的代码来发出请求和plist

 <key>NSAppTransportSecurity</key>
 <dict>
  <key>NSExceptionDomains</key>
  <dict>
        <key>192.168.2.223:1021(my local ip)</key>
        <dict>
        Include to allow subdomains-->
            <key>NSIncludesSubdomains</key>
            <true/>
           <!--Include to allow insecure HTTP requests-->
           <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <!--Include to specify minimum TLS version-->
           <key>NSTemporaryExceptionMinimumTLSVersion</key>
            <string>TLSv1.1</string>
        </dict>
    </dict>
</dict>
Run Code Online (Sandbox Code Playgroud)

在plist中我已经给出了这样的但是我仍然得到错误

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, …
Run Code Online (Sandbox Code Playgroud)

ssl https ios swift

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

数据未插入sqlite数据库

嗨,在我的应用程序中,我有想要插入我的sqlite数据库的数据.所以我已经成功创建了数据库,但问题是它没有将数据插入数据库.

我的数据库创建代码.

 - (void)createDatabase
  {

     NSArray *directories = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
     NSString *doctumentsDirectory = [directories lastObject];
     self.databasePath = [[NSString alloc] initWithString:[doctumentsDirectory stringByAppendingPathComponent:@"/bp.sqlite"]];

     NSFileManager *fileManager = [NSFileManager defaultManager];

   // create DB if it does not already exists
   if (![fileManager fileExistsAtPath:self.databasePath]) {

       const char *dbPath = [self.databasePath UTF8String];

    if (sqlite3_open(dbPath, &_myDataBase) == SQLITE_OK) {

        char *errorMsg;
        const char *sql_statement = "CREATE TABLE IF NOT EXISTS br (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, COST TEXT,QUTY TEXT)";

        if (sqlite3_exec(_myDataBase, sql_statement, NULL, …
Run Code Online (Sandbox Code Playgroud)

sqlite insert ios ios7

0
推荐指数
1
解决办法
971
查看次数

标签 统计

ios ×6

insert ×2

sqlite ×2

swift ×2

armv7 ×1

devicetoken ×1

https ×1

ios7 ×1

objective-c ×1

ssl ×1

uiviewcontroller ×1

xcode ×1