Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
OffcnIMSDKiOS
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
opensource
OffcnIMSDKiOS
Commits
d2eab6a0
Commit
d2eab6a0
authored
Aug 19, 2020
by
zhangyunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
推送本地
parent
6426bfa1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
19 deletions
+24
-19
AppDelegate.m
OffcnIMSDKiOS/AppDelegate.m
+9
-18
Main.storyboard
OffcnIMSDKiOS/Base.lproj/Main.storyboard
+11
-0
ViewController.m
OffcnIMSDKiOS/ViewController.m
+4
-1
No files found.
OffcnIMSDKiOS/AppDelegate.m
View file @
d2eab6a0
...
@@ -26,19 +26,6 @@
...
@@ -26,19 +26,6 @@
self
.
window
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
window
.
backgroundColor
=
[
UIColor
whiteColor
];
[
self
.
window
makeKeyAndVisible
];
[
self
.
window
makeKeyAndVisible
];
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
5
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
UILocalNotification
*
backgroudMsg
=
[[
UILocalNotification
alloc
]
init
];
if
(
backgroudMsg
)
{
backgroudMsg
.
timeZone
=
[
NSTimeZone
defaultTimeZone
];
backgroudMsg
.
alertBody
=
@"VoIP来电"
;
backgroudMsg
.
alertAction
=
@"查看"
;
NSDictionary
*
infoDic
=
[
NSDictionary
dictionaryWithObject
:
@"name"
forKey
:
@"key"
];
backgroudMsg
.
userInfo
=
infoDic
;
[[
UIApplication
sharedApplication
]
presentLocalNotificationNow
:
backgroudMsg
];
//[self cerateAVAudioPlayer];
}
});
//中公直播使用测试环境设置为YES,正式环境设置为NO或者去掉这个配置
//中公直播使用测试环境设置为YES,正式环境设置为NO或者去掉这个配置
NSNumber
*
changeEnvironment
=
[[
NSUserDefaults
standardUserDefaults
]
valueForKey
:
kOffcnIMSDKiOS_changeEnvironment
];
NSNumber
*
changeEnvironment
=
[[
NSUserDefaults
standardUserDefaults
]
valueForKey
:
kOffcnIMSDKiOS_changeEnvironment
];
...
@@ -111,14 +98,14 @@
...
@@ -111,14 +98,14 @@
NSLog
(
@"-----deviceToken ---- ---- %@ devDesc ---%@"
,
deviceToken
,
deviceToken
.
description
);
NSLog
(
@"-----deviceToken ---- ---- %@ devDesc ---%@"
,
deviceToken
,
deviceToken
.
description
);
//tokenStr 得到可用的token。
//tokenStr 得到可用的token。
NSString
*
tokenStr
=
[
NSString
stringWithFormat
:
@"%@"
,
deviceToken
];
//
NSString *tokenStr = [NSString stringWithFormat:@"%@",deviceToken];
tokenStr
=
[
tokenStr
stringByTrimmingCharactersInSet
:[
NSCharacterSet
characterSetWithCharactersInString
:
@"<>"
]];
//将其中的<>去掉
//
tokenStr = [tokenStr stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];//将其中的<>去掉
tokenStr
=
[
tokenStr
stringByReplacingOccurrencesOfString
:
@" "
withString
:
@""
];
//将其中的空格去掉
//
tokenStr = [tokenStr stringByReplacingOccurrencesOfString:@" " withString:@""];//将其中的空格去掉
NSString
*
str
=
[
self
hexStringForData
:
deviceToken
];
NSString
*
str
=
[
self
hexStringForData
:
deviceToken
];
NSLog
(
@"token--- %@"
,
str
);
NSLog
(
@"token--- %@"
,
str
);
//注册成功,返回token
//注册成功,返回token
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"APNS返回的Token:"
message
:
tokenS
tr
delegate
:
self
cancelButtonTitle
:
@"取消"
otherButtonTitles
:
@"确定"
,
nil
];
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"APNS返回的Token:"
message
:
s
tr
delegate
:
self
cancelButtonTitle
:
@"取消"
otherButtonTitles
:
@"确定"
,
nil
];
[
alert
show
];
[
alert
show
];
// applicationIconBadgeNumber
// applicationIconBadgeNumber
...
@@ -151,7 +138,7 @@
...
@@ -151,7 +138,7 @@
}
}
-
(
void
)
application
:(
UIApplication
*
)
application
didReceiveRemoteNotification
:(
NSDictionary
*
)
userInfo
{
-
(
void
)
application
:(
UIApplication
*
)
application
didReceiveRemoteNotification
:(
NSDictionary
*
)
userInfo
{
NSLog
(
@"接收到推送通知 ---- %@"
,
userInfo
);
NSLog
(
@"接收到
远程
推送通知 ---- %@"
,
userInfo
);
/*
/*
...
@@ -172,6 +159,7 @@
...
@@ -172,6 +159,7 @@
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示"
message
:
message
delegate
:
self
cancelButtonTitle
:
@"取消"
otherButtonTitles
:
@"确定"
,
nil
];
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"提示"
message
:
message
delegate
:
self
cancelButtonTitle
:
@"取消"
otherButtonTitles
:
@"确定"
,
nil
];
[
alert
show
];
[
alert
show
];
UILocalNotification
*
backgroudMsg
=
[[
UILocalNotification
alloc
]
init
];
UILocalNotification
*
backgroudMsg
=
[[
UILocalNotification
alloc
]
init
];
if
(
backgroudMsg
)
{
if
(
backgroudMsg
)
{
backgroudMsg
.
timeZone
=
[
NSTimeZone
defaultTimeZone
];
backgroudMsg
.
timeZone
=
[
NSTimeZone
defaultTimeZone
];
...
@@ -183,6 +171,9 @@
...
@@ -183,6 +171,9 @@
//[self cerateAVAudioPlayer];
//[self cerateAVAudioPlayer];
}
}
}
}
-
(
void
)
application
:(
UIApplication
*
)
application
didReceiveLocalNotification
:(
UILocalNotification
*
)
notification
{
NSLog
(
@"接收到本地推送通知 ---- %@"
,
notification
.
userInfo
);
}
-
(
void
)
application
:(
UIApplication
*
)
application
didRegisterUserNotificationSettings
:(
UIUserNotificationSettings
*
)
notificationSettings
{
-
(
void
)
application
:(
UIApplication
*
)
application
didRegisterUserNotificationSettings
:(
UIUserNotificationSettings
*
)
notificationSettings
{
...
...
OffcnIMSDKiOS/Base.lproj/Main.storyboard
View file @
d2eab6a0
...
@@ -93,6 +93,14 @@
...
@@ -93,6 +93,14 @@
<action
selector=
"connectAction:"
destination=
"BYZ-38-t0r"
eventType=
"touchUpInside"
id=
"PbK-7D-LjH"
/>
<action
selector=
"connectAction:"
destination=
"BYZ-38-t0r"
eventType=
"touchUpInside"
id=
"PbK-7D-LjH"
/>
</connections>
</connections>
</button>
</button>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
buttonType=
"roundedRect"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Vmx-zP-DRW"
>
<rect
key=
"frame"
x=
"87"
y=
"95"
width=
"92"
height=
"30"
/>
<color
key=
"backgroundColor"
white=
"0.66666666669999997"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<state
key=
"normal"
title=
"发送本地通知"
/>
<connections>
<action
selector=
"sendLocalNotiAction:"
destination=
"BYZ-38-t0r"
eventType=
"touchUpInside"
id=
"jbM-Ii-Hmr"
/>
</connections>
</button>
</subviews>
</subviews>
<color
key=
"backgroundColor"
red=
"1"
green=
"1"
blue=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<color
key=
"backgroundColor"
red=
"1"
green=
"1"
blue=
"1"
alpha=
"1"
colorSpace=
"custom"
customColorSpace=
"sRGB"
/>
<constraints>
<constraints>
...
@@ -117,7 +125,10 @@
...
@@ -117,7 +125,10 @@
<constraint
firstItem=
"HDM-va-7kG"
firstAttribute=
"top"
secondItem=
"a21-3W-10n"
secondAttribute=
"bottom"
id=
"lS8-hA-rmu"
/>
<constraint
firstItem=
"HDM-va-7kG"
firstAttribute=
"top"
secondItem=
"a21-3W-10n"
secondAttribute=
"bottom"
id=
"lS8-hA-rmu"
/>
<constraint
firstItem=
"7fD-Hf-Afy"
firstAttribute=
"leading"
secondItem=
"TnX-iH-azN"
secondAttribute=
"leading"
id=
"lea-oR-ecV"
/>
<constraint
firstItem=
"7fD-Hf-Afy"
firstAttribute=
"leading"
secondItem=
"TnX-iH-azN"
secondAttribute=
"leading"
id=
"lea-oR-ecV"
/>
<constraint
firstItem=
"1dp-RW-FhV"
firstAttribute=
"height"
secondItem=
"TnX-iH-azN"
secondAttribute=
"height"
id=
"pCJ-es-iPl"
/>
<constraint
firstItem=
"1dp-RW-FhV"
firstAttribute=
"height"
secondItem=
"TnX-iH-azN"
secondAttribute=
"height"
id=
"pCJ-es-iPl"
/>
<constraint
firstItem=
"Vmx-zP-DRW"
firstAttribute=
"height"
secondItem=
"dRe-f0-gnl"
secondAttribute=
"height"
id=
"uLF-IL-l61"
/>
<constraint
firstItem=
"Vmx-zP-DRW"
firstAttribute=
"leading"
secondItem=
"dRe-f0-gnl"
secondAttribute=
"trailing"
constant=
"10"
id=
"vfp-Yh-YD6"
/>
<constraint
firstItem=
"9JE-Lz-Dma"
firstAttribute=
"top"
secondItem=
"1dp-RW-FhV"
secondAttribute=
"bottom"
constant=
"5"
id=
"xMf-AL-l1H"
/>
<constraint
firstItem=
"9JE-Lz-Dma"
firstAttribute=
"top"
secondItem=
"1dp-RW-FhV"
secondAttribute=
"bottom"
constant=
"5"
id=
"xMf-AL-l1H"
/>
<constraint
firstItem=
"Vmx-zP-DRW"
firstAttribute=
"top"
secondItem=
"dRe-f0-gnl"
secondAttribute=
"top"
id=
"zxs-bV-awe"
/>
</constraints>
</constraints>
</view>
</view>
<connections>
<connections>
...
...
OffcnIMSDKiOS/ViewController.m
View file @
d2eab6a0
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
#import "ViewController.h"
#import "ViewController.h"
#import "OffcnIMSDKiOS.h"
#import "OffcnIMSDKiOS.h"
#import "OffcnNetworkExecutor.h"
#import "OffcnNetworkExecutor.h"
//#import
"oimcoreAdapter.h"
//#import
<oimcore/oimcoreAdapter.h>
@interface
ViewController
()
<
UITextFieldDelegate
>
@interface
ViewController
()
<
UITextFieldDelegate
>
...
@@ -41,6 +41,9 @@
...
@@ -41,6 +41,9 @@
-
(
IBAction
)
connectAction
:(
UIButton
*
)
sender
{
-
(
IBAction
)
connectAction
:(
UIButton
*
)
sender
{
}
}
-
(
IBAction
)
sendLocalNotiAction
:(
UIButton
*
)
sender
{
}
-
(
IBAction
)
sendMeg
:(
UIButton
*
)
sender
{
-
(
IBAction
)
sendMeg
:(
UIButton
*
)
sender
{
//发送消息
//发送消息
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment